https://github.com/markis/strip-whitespace-plugin
Strip whitespace from strings within javascript files
https://github.com/markis/strip-whitespace-plugin
asset-pipeline minification performance webpack webpack-plugin webpack2 whitespace
Last synced: 6 months ago
JSON representation
Strip whitespace from strings within javascript files
- Host: GitHub
- URL: https://github.com/markis/strip-whitespace-plugin
- Owner: markis
- License: mit
- Archived: true
- Created: 2017-03-15T04:07:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-08T01:35:54.000Z (over 5 years ago)
- Last Synced: 2024-09-24T20:04:13.202Z (10 months ago)
- Topics: asset-pipeline, minification, performance, webpack, webpack-plugin, webpack2, whitespace
- Language: TypeScript
- Homepage: https://npm.im/strip-whitespace-plugin
- Size: 81.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# strip-whitespace-plugin
[](https://www.npmjs.com/package/strip-whitespace-plugin)
[](https://travis-ci.org/markis/strip-whitespace-plugin)
[](https://ci.appveyor.com/project/markis/strip-whitespace-plugin)
[](https://snyk.io/test/github/markis/strip-whitespace-plugin)
[](https://david-dm.org/markis/strip-whitespace-plugin)
[](https://greenkeeper.io/)
[](https://coveralls.io/github/markis/strip-whitespace-plugin)
[](https://www.codacy.com/app/markis/strip-whitespace-plugin)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](https://npm.im/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:
``` javascript
function() {
if (condition) {
const longString = ' String with some extra spaces ';
}
}
```##### After strip-whitespace:
``` javascript
function() {
if (condition) {
const longString = ' String with some extra spaces ';
}
}
```##### Webpack usage
Put this plugin before your minification plugins (ex. uglify-js)
``` javascript
var StripWhitespace = require('strip-whitespace-plugin');module.exports = {
...
plugins: [
new StripWhitespace(),
...
// put your minification plugins here.
]
...
};```