Skip to content
This repository was archived by the owner on Dec 25, 2018. It is now read-only.

Drop styleExtensions #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (`<entry name> -> <paths>`). It can be a good idea [glob](http://npmjs.org/glob) these.
Expand Down
6 changes: 2 additions & 4 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -45,8 +44,7 @@ module.exports = [
paths: {
first: glob.sync(`${PATHS.app}/*`),
second: glob.sync(`${PATHS.another}/*`)
},
styleExtensions: ['.css']
}
})
)
];
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
7 changes: 0 additions & 7 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ const schema = ({ entry } = {}) => ({
additionalProperties: false,
type: 'object',
properties: {
styleExtensions: {
type: 'array',
items: {
type: 'string'
},
default: ['.css']
},
minimize: {
type: 'boolean'
},
Expand Down
12 changes: 0 additions & 12 deletions src/validate-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down