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: 0a410a9bf28c7b0e81a3470a13748e68ca2f50aa
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: 09d29b323d0befd900f4691967033dbab480b389
Choose a head ref
  • 5 commits
  • 8 files changed
  • 1 contributor

Commits on Aug 30, 2020

  1. Update dependencies (#133)

    Update nvm node version
    Add .editorconfig
    Update dev dependencies
    Remove some dependencies vulnerabilities (`npm audit fix`)
    NMFR authored Aug 30, 2020
    Copy the full SHA
    b3a3ada View commit details
  2. 5.0.4

    NMFR committed Aug 30, 2020
    Copy the full SHA
    e9b84f1 View commit details

Commits on Oct 21, 2020

  1. Copy the full SHA
    41d1e23 View commit details

Commits on May 16, 2021

  1. Copy the full SHA
    d0a7da7 View commit details
  2. 5.0.5

    NMFR committed May 16, 2021
    Copy the full SHA
    09d29b3 View commit details
Showing with 20,109 additions and 8,539 deletions.
  1. +16 −0 .editorconfig
  2. +1 −1 .nvmrc
  3. +2 −0 README.md
  4. +20,072 −8,528 package-lock.json
  5. +8 −7 package.json
  6. +8 −1 src/index.js
  7. +1 −1 test/__snapshots__/webpack-integration.test.js.snap
  8. +1 −1 test/cases/only-assetNameRegExp-processed/expected/optimize.css
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[*.md]
indent_size = 4
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.9.4
v14.9.0
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

A Webpack plugin to optimize \ minimize CSS assets.

> :warning: For webpack v5 or above please use [css-minimizer-webpack-plugin](https://github.com/webpack-contrib/css-minimizer-webpack-plugin) instead.
## What does the plugin do?

It will search for CSS assets during the Webpack build and will optimize \ minimize the CSS (by default it uses [cssnano](http://github.com/ben-eb/cssnano) but a custom CSS processor can be specified).
28,600 changes: 20,072 additions & 8,528 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 8 additions & 7 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.3",
"version": "5.0.5",
"description": "A Webpack plugin to optimize \\ minimize CSS assets.",
"keywords": [
"CSS",
@@ -30,20 +30,21 @@
]
},
"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",
"babel-jest": "^22.1.0",
"babel-jest": "^26.3.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"css-loader": "^3.0.0",
"css-loader": "^3.6.0",
"extract-text-webpack-plugin": "next",
"jest": "^24.8.0",
"jest": "^26.4.2",
"style-loader": "^0.20.1",
"webpack": "^4.9.1"
"webpack": "^4.44.1"
},
"peerDependencies": {
"webpack": "^4.0.0"
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}