rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

support Rollup [hash] placeholder

Open alexdilley opened this issue 5 years ago • 4 comments

Breaking change

Utilize emitFile({ type: 'asset' }) plugin context utility function to allow extracted file to respect Rollup's assetFileNames name pattern, and thus support unique/cache-busting file naming based on the content of the asset.

Requires users who specify the plugin option, extract: true (explicit string paths are unaffected), to configure Rollup's output.assetFileNames setting (to '[name][extname]'), since this defaults to placing the generated .css/.css.map files under an assets directory relative to output.dir (as well as adding the [hash] placeholder to the file name), which hence doesn't mirror present functionality.

alexdilley avatar Jan 29 '20 15:01 alexdilley

Codecov Report

Merging #226 into master will increase coverage by 0.02%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #226      +/-   ##
==========================================
+ Coverage   91.69%   91.72%   +0.02%     
==========================================
  Files           9        9              
  Lines         289      290       +1     
  Branches      100       98       -2     
==========================================
+ Hits          265      266       +1     
  Misses         24       24
Impacted Files Coverage Δ
src/index.js 96.34% <100%> (+0.04%) :arrow_up:

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 06a2771...d37d9da. Read the comment docs.

codecov[bot] avatar Jan 29 '20 15:01 codecov[bot]

It would be really great to have hashing behaviour. I'd love to know why it was not progressed to live

dagda1 avatar Oct 17 '20 07:10 dagda1

+1! Can we add support for this?

pspeter3 avatar Oct 17 '20 20:10 pspeter3

I haven't tested the latest code in master, but is this PR still necessary? I see additional usage of emitFile in master now, so perhaps this has already been implemented?

https://github.com/egoist/rollup-plugin-postcss/blob/ceee1bc87d91d6c2692e2f44ae2753fa83a0b535/src/index.js#L244

benmccann avatar Dec 07 '20 16:12 benmccann