Skip to content

Webpack plugin to strip blocks of code marked by special comment tags

License

Notifications You must be signed in to change notification settings

wbern/webpack-strip-block

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Strip Block

Webpack loader to strip blocks of code marked by special comment tags

###Example:

In your client js source files:

var makeFoo(bar, baz) {
    // The following code will be stripped with our webpack loader
    /* develblock:start */
    if (bar instanceof Bar !== true) {
        throw new Error('makeFoo: bar param is required and must be instance of Bar');
    }
    /* develblock:end */

    // This code would remain
    return new Foo(bar, baz);
}

In your webpack config:

{
    module: {
        loaders: [
            { test: /\.js$/, loader: "webpack-strip-block" }
        ]
    }
};

It is also possible to overwrite the start and end variables with url-encoded string values:

{
    module: {
        loaders: [
            { test: /\.js$/, loader: "webpack-strip-block?start=DEV-START&end=DEV-END" }
        ]
    }
};

About

Webpack plugin to strip blocks of code marked by special comment tags

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%