From d1e1185e19cba6bfc84ff789f86a064c1fe6be3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Kronm=C3=BCller?= Date: Thu, 8 Jun 2017 21:29:32 +0200 Subject: [PATCH 1/2] breaking: drop `styleExtensions` --- README.md | 1 - examples/webpack.config.js | 4 +--- src/index.js | 2 +- src/schema.js | 7 ------- src/validate-options.test.js | 12 ------------ 5 files changed, 2 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0921706..dc37a44 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ This plugin, unlike the original PurifyCSS plugin, provides special features, su | Property | Description |---------------------|------------ -| `styleExtensions` | An array of file extensions for determining used classes within style files. Defaults to `['.css']`. | `moduleExtensions` | An array of file extensions for determining used classes within `node_modules`. Defaults to `[]`, but `['.html']` can be useful here. | `minimize` | Enable CSS minification. Alias to `purifyOptions.minify`. Disabled by default. | `paths` | An array of absolute paths or a path to traverse. This also accepts an object (` -> `). It can be a good idea [glob](http://npmjs.org/glob) these. diff --git a/examples/webpack.config.js b/examples/webpack.config.js index aacb91d..c9662eb 100644 --- a/examples/webpack.config.js +++ b/examples/webpack.config.js @@ -25,8 +25,7 @@ module.exports = [ parts.purifyCSS({ verbose: true, minimize: true, - paths: glob.sync(`${PATHS.app}/*`), - styleExtensions: ['.css'] + paths: glob.sync(`${PATHS.app}/*`) }) ), merge( @@ -46,7 +45,6 @@ module.exports = [ first: glob.sync(`${PATHS.app}/*`), second: glob.sync(`${PATHS.another}/*`) }, - styleExtensions: ['.css'] }) ) ]; diff --git a/src/index.js b/src/index.js index 3acdaaf..6808265 100644 --- a/src/index.js +++ b/src/index.js @@ -38,7 +38,7 @@ module.exports = function PurifyPlugin(options) { compilation.chunks.forEach( ({ name: chunkName, files, modules }) => { const assetsToPurify = search.assets( - compilation.assets, options.styleExtensions + compilation.assets, ['.css'] ).filter( asset => files.indexOf(asset.name) >= 0 ); diff --git a/src/schema.js b/src/schema.js index cce104d..9a5778c 100644 --- a/src/schema.js +++ b/src/schema.js @@ -3,13 +3,6 @@ const schema = ({ entry } = {}) => ({ additionalProperties: false, type: 'object', properties: { - styleExtensions: { - type: 'array', - items: { - type: 'string' - }, - default: ['.css'] - }, minimize: { type: 'boolean' }, diff --git a/src/validate-options.test.js b/src/validate-options.test.js index fbae580..160da2b 100644 --- a/src/validate-options.test.js +++ b/src/validate-options.test.js @@ -33,18 +33,6 @@ describe('Validate options', function () { assert.ok(result.error); }); - it('styleExtensions have defaults', function () { - const paths = ['./foo']; - const data = { paths }; - - // Currently this mutates data with defaults due to ajv design. It - // might be a good idea to change that behavior, though. - const result = validateOptions(schema(), data); - - assert.deepEqual(data, { paths, styleExtensions: ['.css'] }); - assert.ok(!result.error); - }); - it('fails without matching path keys', function () { const data = { paths: { From 67a1a551fd128ed4a2ebb7116590f3adf42ba614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Kronm=C3=BCller?= Date: Thu, 8 Jun 2017 21:33:30 +0200 Subject: [PATCH 2/2] chore: remove unexpected trailing comma --- examples/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webpack.config.js b/examples/webpack.config.js index c9662eb..1a3f199 100644 --- a/examples/webpack.config.js +++ b/examples/webpack.config.js @@ -44,7 +44,7 @@ module.exports = [ paths: { first: glob.sync(`${PATHS.app}/*`), second: glob.sync(`${PATHS.another}/*`) - }, + } }) ) ];