diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d71220..4a3dba25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [2.0.9](https://github.com/postcss/postcss-loader/compare/v2.0.8...v2.0.9) (2017-11-24) + + +### Bug Fixes + +* **index:** filter `ident` (`options.ident`) ([#315](https://github.com/postcss/postcss-loader/issues/315)) ([3e1c7fa](https://github.com/postcss/postcss-loader/commit/3e1c7fa)) + + + ## [2.0.8](https://github.com/postcss/postcss-loader/compare/v2.0.6...v2.0.8) (2017-10-14) diff --git a/README.md b/README.md index 9e83df49..c7838f21 100644 --- a/README.md +++ b/README.md @@ -350,7 +350,7 @@ either add the css-loader’s [`importLoaders`] option. or use [postcss-modules] instead of `css-loader`. -[`importLoaders`]: https://github.com/webpack-contrib/css-loader#importing-and-chained-loaders +[`importLoaders`]: https://github.com/webpack-contrib/css-loader#importloaders [cannot be used]: https://github.com/webpack/css-loader/issues/137 [CSS Modules]: https://github.com/webpack/css-loader#css-modules [postcss-modules]: https://github.com/outpunk/postcss-modules diff --git a/lib/index.js b/lib/index.js index fb77b99d..c3b03fbc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -51,12 +51,16 @@ module.exports = function loader (css, map) { Promise.resolve().then(() => { const length = Object.keys(options) - .filter((option) => { - // if (option === 'exec') return - if (option === 'config') return - if (option === 'sourceMap') return - - return option + .filter((option) => { + switch (option) { + // case 'exec': + case 'ident': + case 'config': + case 'sourceMap': + return + default: + return option + } }) .length diff --git a/package.json b/package.json index 7510593d..af683ebe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postcss-loader", - "version": "2.0.8", + "version": "2.0.9", "description": "PostCSS loader for webpack", "main": "lib/index.js", "engines": { diff --git a/test/options/__snapshots__/config.test.js.snap b/test/options/__snapshots__/config.test.js.snap index 16f6b8fc..86a0e9a7 100644 --- a/test/options/__snapshots__/config.test.js.snap +++ b/test/options/__snapshots__/config.test.js.snap @@ -2,6 +2,8 @@ exports[`Options Config - {Object} 1`] = `"module.exports = \\"a { color: rgba(255, 0, 0, 1.0) }\\\\n\\""`; +exports[`Options Config - Context - {Object} - with ident 1`] = `"module.exports = \\"a { color: rgba(255, 0, 0, 1.0) }\\\\n\\""`; + exports[`Options Config - Context - {Object} 1`] = `"module.exports = \\"a { color: rgba(255, 0, 0, 1.0) }\\\\n\\""`; exports[`Options Config - Path - {String} 1`] = `"module.exports = \\"a { color: black }\\\\n\\""`; diff --git a/test/options/config.test.js b/test/options/config.test.js index 352bac75..78135158 100644 --- a/test/options/config.test.js +++ b/test/options/config.test.js @@ -53,4 +53,26 @@ describe('Options', () => { expect(src).toMatchSnapshot() }) }) + + + test('Config - Context - {Object} - with ident', () => { + const config = { + loader: { + options: { + ident: 'postcss', + config: { + path: 'test/fixtures/config/postcss.config.js', + ctx: { plugin: true } + } + } + } + } + + return webpack('css/index.js', config).then((stats) => { + const src = loader(stats).src + + expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"") + expect(src).toMatchSnapshot() + }) + }) })