Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 934 Bytes

README.md

File metadata and controls

47 lines (37 loc) · 934 Bytes

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" }
        ]
    }
};