strip-whitespace-plugin

    1.0.3 • Public • Published

    strip-whitespace-plugin

    node Travis AppVeyor Known Vulnerabilities David Greenkeeper badge Coveralls Codacy grade

    Strip-Whitespace-Plugin is a plugin for webpack that will remove extraneous spaces from strings. It's perfect for working with rendering templates (ex. mustache, handlebars) or es6 javascript templates. It works with anything where you might create very long strings.

    This plugin and the Strip-Whitespace-Loader do the same thing. The loader can be applied to specific modules/files/assets. This plugin will strip whitespace on all assets.

    Before strip-whitespace:
    function() {
      if (condition) {
        const longString = '  String   with    some    extra   spaces  ';
      }
    }
    After strip-whitespace:
    function() {
      if (condition) {
        const longString = ' String with some extra spaces ';
      }
    }
    Webpack usage

    Put this plugin before your minification plugins (ex. uglify-js)

    var StripWhitespace = require('strip-whitespace-plugin');
     
    module.exports = {
      ...
      plugins: [
        new StripWhitespace(),
        ...
        // put your minification plugins here.
      ]
      ...
    };
     

    Install

    npm i strip-whitespace-plugin

    DownloadsWeekly Downloads

    3

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • markis