From fc11952745f6915e4c8876cbd3c65f0475684f55 Mon Sep 17 00:00:00 2001 From: klimashkin Date: Fri, 25 Sep 2020 23:35:45 -0700 Subject: [PATCH] Update to PostCSS 8. Require NodeJS 10+ --- .gitignore | 1 + .npmrc | 1 + README.md | 12 ++++++------ package.json | 14 +++++++++----- 4 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .npmrc diff --git a/.gitignore b/.gitignore index d1ca081..26c8778 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ .* +!.npmrc !.gitignore !.editorconfig \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/README.md b/README.md index 83d6da1..9a307a4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This webpack plugin gets css extracted by [MiniCssExtractPlugin](https://github. If you use postcss-loader, not all its plugins are effective in file-by-file processing. For instance, css structural optimizations or media query packaging better apply to one css production file that can be generated by MiniCssExtractPlugin. # Installation -`npm i postcss-assets-webpack-plugin` +`npm install --save-dev webpack postcss postcss-assets-webpack-plugin` # Options * `test` - regular expression for matching files returned from MiniCssExtractPlugin. @@ -22,15 +22,15 @@ import mqpacker from 'mqpacker'; import autoprefixer from 'autoprefixer'; import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import PostCSSAssetsPlugin from 'postcss-assets-webpack-plugin'; - + const devMode = process.env.NODE_ENV !== 'production' - + webpackConfig = { <...> postcss() { return [autoprefixer({browser: 'last 2 version', cascade: false})] }, - + module: { rules: [ { @@ -61,13 +61,13 @@ webpackConfig = { } ], }, - + plugins: [ new MiniCssExtractPlugin({ filename: devMode ? '[name].css' : '[name].[hash].css', chunkFilename: devMode ? '[id].css' : '[id].[hash].css', }) - + new PostCSSAssetsPlugin({ test: /\.css$/, log: true, diff --git a/package.json b/package.json index 9008c17..b99ba55 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,17 @@ }, "main": "index.js", "peerDependencies": { - "webpack": "^4.10.2" + "postcss": "^8.0.9", + "webpack": "^4.40.0" + }, + "devDependencies": { + "postcss": "^8.0.9", + "webpack": "^4.40.0" }, "dependencies": { - "fancy-log": "^1.3.2", + "fancy-log": "^1.3.3", "human-size": "^1.1.0", - "postcss": "^7.0.0", - "webpack-sources": "^1.1.0" + "webpack-sources": "^1.4.0" }, "keywords": [ "css", @@ -33,6 +37,6 @@ "postcss-assets-webpack-plugin" ], "engines": { - "node": ">=6.0.0" + "node": ">=10.0.0" } }