webpack-contrib / purifycss-webpack

UNMAINTAINED, use https://github.com/FullHuman/purgecss-webpack-plugin
MIT License
772 stars 37 forks source link

Fix chunk file match dependency on [name] #86

Closed t47io closed 7 years ago

t47io commented 7 years ago

Fix for issue #85

Previously, compilation.chunks require [name] to be present in filename out of ExtractTextPlugin. Otherwise the CSS asset fails to match, and is omitted. This fix now uses full filename match instead.

jsf-clabot commented 7 years ago

CLA assistant check
All committers have signed the CLA.

t47io commented 7 years ago

@bebraw Should I also bump up version to 0.4.3?

Eh, not sure what to do about the coverage///

codecov[bot] commented 7 years ago

Codecov Report

Merging #86 into master will not change coverage. The diff coverage is 0%.

@@           Coverage Diff           @@
##           master      #86   +/-   ##
=======================================
  Coverage   66.21%   66.21%           
=======================================
  Files           5        5           
  Lines          74       74           
  Branches       22       22           
=======================================
  Hits           49       49           
  Misses         25       25
Impacted Files Coverage Δ
src/index.js 0% <0%> (ø) :white_check_mark:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f3ef545...2843b11. Read the comment docs.

bebraw commented 7 years ago

@t47io No need to bump version. That's my problem. 👍

About testing, I have a couple of examples at the repo. The problem is that you have to inspect the output manually. I guess ideally we would capture the output somehow and compare.

I can test this myself, but having something stronger in place would be nice. Maybe the right way to do it would be to run webpack through Node and capture stats of the build? Then we would have something easy to compare.

t47io commented 7 years ago

Did that, looks successful to me:

> examples@ build /Users/t47/Desktop/purifycss-webpack/examples
> webpack

fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Assets to purify: app.css
Files to search for used rules: /Users/t47/Desktop/purifycss-webpack/examples/app/component.js, /Users/t47/Desktop/purifycss-webpack/examples/app/index.js, /Users/t47/Desktop/purifycss-webpack/examples/app/main.css
##################################
PurifyCSS has reduced the file size by ~89.2%
##################################
This function took:  40 ms
Hash: f2e253fafe7b45dcf53d2025c10d2df6b7fc85ea
Version: webpack 2.2.1
Child
    Hash: f2e253fafe7b45dcf53d
    Time: 1495ms
      Asset     Size  Chunks             Chunk Names
     app.js  3.81 kB       0  [emitted]  app
    app.css  1.78 kB       0  [emitted]  app
       [0] ./app/component.js 173 bytes {0} [built]
       [1] ./app/main.css 41 bytes {0} [built]
       [2] ./~/purecss/build/pure-min.css 41 bytes {0} [built]
       [3] ./app/index.js 117 bytes {0} [built]
       [4] ./~/css-loader?sourceMap!./app/main.css 510 bytes [built]
       [5] ./~/css-loader?sourceMap!./~/purecss/build/pure-min.css 37.4 kB [built]
       [6] ./~/css-loader/lib/css-base.js 1.46 kB [built]
       [7] ./~/style-loader/addStyles.js 6.91 kB [built]
    Child extract-text-webpack-plugin:
           [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built]
           [1] ./~/css-loader?sourceMap!./~/purecss/build/pure-min.css 37.4 kB {0} [built]
    Child extract-text-webpack-plugin:
           [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built]
           [1] ./~/css-loader?sourceMap!./app/main.css 510 bytes {0} [built]
Child
    Hash: 2025c10d2df6b7fc85ea
    Time: 1475ms
         Asset       Size  Chunks             Chunk Names
      first.js    3.83 kB       0  [emitted]  first
     second.js    3.83 kB       1  [emitted]  second
     first.css    2.21 kB       0  [emitted]  first
    second.css  804 bytes       1  [emitted]  second
       [0] ./~/purecss/build/pure-min.css 41 bytes {0} {1} [built]
       [1] ./another/component.js 178 bytes {1} [built]
       [2] ./app/component.js 173 bytes {0} [built]
       [3] ./another/main.css 41 bytes {1} [built]
       [4] ./app/main.css 41 bytes {0} [built]
       [5] ./another/index.js 117 bytes {1} [built]
       [6] ./app/index.js 117 bytes {0} [built]
       [7] ./~/css-loader?sourceMap!./another/main.css 514 bytes [built]
       [8] ./~/css-loader?sourceMap!./app/main.css 510 bytes [built]
       [9] ./~/css-loader?sourceMap!./~/purecss/build/pure-min.css 37.4 kB [built]
      [10] ./~/css-loader/lib/css-base.js 1.46 kB [built]
      [11] ./~/style-loader/addStyles.js 6.91 kB [built]
    Child extract-text-webpack-plugin:
           [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built]
           [1] ./~/css-loader?sourceMap!./~/purecss/build/pure-min.css 37.4 kB {0} [built]
    Child extract-text-webpack-plugin:
           [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built]
           [1] ./~/css-loader?sourceMap!./app/main.css 510 bytes {0} [built]
    Child extract-text-webpack-plugin:
           [0] ./~/css-loader/lib/css-base.js 1.46 kB {0} [built]
           [1] ./~/css-loader?sourceMap!./another/main.css 514 bytes {0} [built]
t47io commented 7 years ago

Also, please consider editing the examples/README.md:

Maybe include a folder like examples/build-std or something, and we can diff between examples/build/*.css to it to make sure the contents are the same?

bebraw commented 7 years ago

Also, please consider editing the examples/README.md:

Done.

Maybe include a folder like examples/build-std or something, and we can diff between examples/build/*.css to it to make sure the contents are the same?

How about webpack --json? We can capture the output JSON, filter somehow perhaps, and compare. That would be enough for a test if we capture something to compare against.

I published 0.4.3 including your improvement. Thanks a lot!