Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NMFR/optimize-css-assets-webpack-plugin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0bf176a01b144cd8736f01c409dd1214ecfbe8c
Choose a base ref
...
head repository: NMFR/optimize-css-assets-webpack-plugin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 29c44fb66559887294f18238aa1465cde7d45e24
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on May 17, 2021

  1. Copy the full SHA
    51313e4 View commit details
  2. 6.0.0

    NMFR committed May 17, 2021
    Copy the full SHA
    29c44fb View commit details
Showing with 809 additions and 1,033 deletions.
  1. +795 −1,027 package-lock.json
  2. +4 −3 package.json
  3. +8 −1 src/index.js
  4. +1 −1 test/__snapshots__/webpack-integration.test.js.snap
  5. +1 −1 test/cases/only-assetNameRegExp-processed/expected/optimize.css
1,822 changes: 795 additions & 1,027 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "optimize-css-assets-webpack-plugin",
"version": "5.0.6",
"version": "6.0.0",
"description": "A Webpack plugin to optimize \\ minimize CSS assets.",
"keywords": [
"CSS",
@@ -30,8 +30,9 @@
]
},
"dependencies": {
"cssnano": "^4.1.10",
"last-call-webpack-plugin": "^3.0.0"
"cssnano": "^5.0.2",
"last-call-webpack-plugin": "^3.0.0",
"postcss": "^8.2.1"
},
"devDependencies": {
"babel-core": "^6.26.3",
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@ const url = require('url');

const LastCallWebpackPlugin = require('last-call-webpack-plugin');

function getDefaultProcessor() {
const postcss = require('postcss');
const cssnano = require('cssnano');

return postcss([cssnano()]);
}

class OptimizeCssAssetsWebpackPlugin extends LastCallWebpackPlugin {
constructor(options) {
super({
@@ -20,7 +27,7 @@ class OptimizeCssAssetsWebpackPlugin extends LastCallWebpackPlugin {
/\.css(\?.*)?$/i :
options.assetNameRegExp;
this.options.cssProcessor = !options || !options.cssProcessor ?
require('cssnano') :
getDefaultProcessor() :
options.cssProcessor;
this.options.cssProcessorOptions = !options || options.cssProcessorOptions === undefined ?
{} :
2 changes: 1 addition & 1 deletion test/__snapshots__/webpack-integration.test.js.snap
Original file line number Diff line number Diff line change
@@ -17,6 +17,6 @@ p {
"
`;

exports[`Webpack Integration Tests only-assetNameRegExp-processed 2`] = `"a{color:#00f}body{margin:0;color:red}p{margin:1000px}"`;
exports[`Webpack Integration Tests only-assetNameRegExp-processed 2`] = `"a{color:#00f}body{color:red;margin:0}p{margin:1000px}"`;

exports[`Webpack Integration Tests removes-duplicate-css 1`] = `"a{color:#00f}body{color:red}p{color:green}"`;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a{color:#00f}body{margin:0;color:red}p{margin:1000px}
a{color:#00f}body{color:red;margin:0}p{margin:1000px}