From f9346a3e69b446141ffd44b9aea4e02ffb8a081a Mon Sep 17 00:00:00 2001 From: Rajiv Tirumalareddy Date: Wed, 21 Jan 2015 10:40:03 -0800 Subject: [PATCH 1/2] Rename to strip-loader --- CONTRIBUTING.md | 6 +++--- README.md | 39 +++++++++++++++++++++++++++------------ package.json | 6 +++--- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bbf64c..b7c5550 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ -Contributing Code to `webpack-strip` +Contributing Code to `strip-loader` ------------------------------- -Please be sure to sign our [CLA][] before you submit pull requests or otherwise contribute to `webpack-strip`. This protects developers, who rely on [BSD license][]. +Please be sure to sign our [CLA][] before you submit pull requests or otherwise contribute to `strip-loader`. This protects developers, who rely on [BSD license][]. -[BSD license]: https://github.com/yahoo/webpack-strip/blob/master/LICENSE.md +[BSD license]: https://github.com/yahoo/strip-loader/blob/master/LICENSE.md [CLA]: https://yahoocla.herokuapp.com/ diff --git a/README.md b/README.md index a963bbc..cdd9459 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# Webpack Strip +# Strip Loader -[![npm version](https://badge.fury.io/js/webpack-strip.svg)](http://badge.fury.io/js/webpack-strip) -[![Build Status](https://travis-ci.org/yahoo/webpack-strip.svg?branch=master)](https://travis-ci.org/yahoo/webpack-strip) -[![Dependency Status](https://david-dm.org/yahoo/webpack-strip.svg)](https://david-dm.org/yahoo/webpack-strip) -[![devDependency Status](https://david-dm.org/yahoo/webpack-strip/dev-status.svg)](https://david-dm.org/yahoo/webpack-strip#info=devDependencies) -[![Coverage Status](https://coveralls.io/repos/yahoo/webpack-strip/badge.png?branch=master)](https://coveralls.io/r/yahoo/webpack-strip?branch=master) +[![npm version](https://badge.fury.io/js/strip-loader.svg)](http://badge.fury.io/js/strip-loader) +[![Build Status](https://travis-ci.org/yahoo/strip-loader.svg?branch=master)](https://travis-ci.org/yahoo/strip-loader) +[![Dependency Status](https://david-dm.org/yahoo/strip-loader.svg)](https://david-dm.org/yahoo/strip-loader) +[![devDependency Status](https://david-dm.org/yahoo/strip-loader/dev-status.svg)](https://david-dm.org/yahoo/strip-loader#info=devDependencies) +[![Coverage Status](https://coveralls.io/repos/yahoo/strip-loader/badge.png?branch=master)](https://coveralls.io/r/yahoo/strip-loader?branch=master) Simple [Webpack](http://webpack.github.io/) loader to strip custom functions from your code. This can be useful if you want to use debug statements while developing your app but don't want this info exposed in your production code. ## Install -`npm install --save-dev webpack-strip` +`npm install --save-dev strip-loader` ## Usage @@ -38,7 +38,7 @@ In your webpack config: { module: { loaders: [ - { test: /\.js$/, loader: "webpack-strip?strip[]=debug" } + { test: /\.js$/, loader: "strip-loader?strip[]=debug" } ] } }; @@ -51,7 +51,7 @@ In your webpack config: { module: { loaders: [ - { test: /\.js$/, loader: "webpack-strip?strip[]=debug,strip[]=console.log" } + { test: /\.js$/, loader: "strip-loader?strip[]=debug,strip[]=console.log" } ] } }; @@ -61,8 +61,9 @@ In your webpack config: In your webpack config: ```javascript -var WebpackStrip = require('webpack-strip') -{ +var WebpackStrip = require('strip-loader') + +var webpackConfig = { module: { loaders: [ { test: /\.js$/, loader: WebpackStrip.loader('debug', 'console.log') } @@ -71,9 +72,23 @@ var WebpackStrip = require('webpack-strip') }; ``` +### Remove stripped functions from bundle + +So far we've removed the calls to the debug function, but webpack will still include the `debug` module in the final bundle. Use the [`IgnorePlugin`](http://webpack.github.io/docs/list-of-plugins.html#ignoreplugin) + +```javascript +{ + plugins: [ + new webpack.IgnorePlugin(/debug/) + ] +} +``` + + + ## License This software is free to use under the Yahoo! Inc. BSD license. See the [LICENSE file][] for license text and copyright information. -[LICENSE file]: https://github.com/yahoo/webpack-strip/blob/master/LICENSE.md +[LICENSE file]: https://github.com/yahoo/strip-loader/blob/master/LICENSE.md diff --git a/package.json b/package.json index e72965e..799009a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "webpack-strip", + "name": "strip-loader", "version": "0.1.0", "description": "Webpack loader to strip arbitrary functions out of your production code.", "main": "lib/index.js", @@ -14,7 +14,7 @@ ], "repository": { "type": "git", - "url": "git@github.com:yahoo/webpack-strip" + "url": "git@github.com:yahoo/strip-loader" }, "author": "Rajiv Tirumalareddy ", "devDependencies": { @@ -31,7 +31,7 @@ "licenses": [ { "type": "BSD", - "url": "https://github.com/yahoo/webpack-strip/blob/master/LICENSE.md" + "url": "https://github.com/yahoo/strip-loader/blob/master/LICENSE.md" } ], "jshintConfig": { From 90f118d360cebd9b5ed41f7a4936d3a3534d7a74 Mon Sep 17 00:00:00 2001 From: Rajiv Tirumalareddy Date: Wed, 21 Jan 2015 14:08:20 -0800 Subject: [PATCH 2/2] comment fixes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cdd9459..05e5bf1 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ In your webpack config: In your webpack config: ```javascript -var WebpackStrip = require('strip-loader') +var WebpackStrip = require('strip-loader'); var webpackConfig = { module: {