strip-whitespace-loader

Strip whitespace from strings in javascript assets

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
strip-whitespace-loader
211.0.45 years ago6 years agoMinified + gzip package size for strip-whitespace-loader in KB

Readme

strip-whitespace-loader
node Travis AppVeyor Known Vulnerabilities David Greenkeeper badge Coveralls Codacy grade
Strip-Whitespace-Loader is a loader 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.
Before strip-whitespace-loader:
function() {
  if (condition) {
    const longString = '  String   with    some    extra   spaces  ';
  }
}
After strip-whitespace-loader:
function() {
  if (condition) {
    const longString = ' String with some extra spaces ';
  }
}
Webpack usage
{
  module: {
    rules:[
      {
        test: /\.js$/,
        loader: [ 'strip-whitespace-loader', 'babel-loader' ]
      },
      {
        test: /\.tsx?$/,
        loader: [ 'strip-whitespace-loader', 'ts-loader' ]
      }
    ]
  }
}