Coder Social home page Coder Social logo

darekf77 / isomorphic-region-loader Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 6.06 MB

Strip off code inside #regions from your bundle and be happy with your isomorphic javascript/typescipt apps.

JavaScript 0.74% TypeScript 60.88% HTML 38.38%
isomorphic-javascript isomorphic webpack-loader typescript javascript

isomorphic-region-loader's Introduction

Isomorphic #region Loader

A loader for webpack that lets you strip #regions code from bundle.

Install

npm install --save-dev isomorphic-region-loader

Usage

This load is very helpfull if you wanna write isomorphic applications in javascript or typescript. Just specify region and this loader will cut it from bundle. Example:

import * as jquery from 'jquery'
//#region nodejs
import * as fs from 'fs'
//#endregion

class ExampleIsomorphicClass {
  ...
}

With webpack configuraiton below:

module.exports = {
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: 'isomorphic-region-loader',
        options: { platform: 'browser' }  // 'borwser' default platform, also there is 'nodejs'
      }
    ]
  }
}

You will get:

import * as jquery from 'jquery'

class ExampleIsomorphicClass {
  ...
}

As result, code inside #region nodejs has been stripped. Also you can do similar things to your nodejs code and strip off browser things.

Inline

In your application

import {  ExampleIsomorphicClass } from '!isomorphic-region-loader!./isomorphic-class.ts';

isomorphic-region-loader's People

Contributors

darekf77 avatar darekf77igt avatar fresheneesz avatar joeheyming avatar joshwiens avatar kevinzwhuang avatar michael-ciniawsky avatar montogeek avatar nocke avatar shama avatar simon04 avatar sokra avatar spacek33z avatar thelarkinn avatar tillsanders avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.