Anidetrix / rollup-plugin-styles

🎨 Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
https://anidetrix.github.io/rollup-plugin-styles
MIT License
242 stars 43 forks source link

Use fileName instead of name for getName #142

Closed warlo closed 3 years ago

warlo commented 3 years ago

Hey!

A suggestion that would solve one problem we are running into using this library. We mode: extract scss that is code-splitted like the js chunks, but some of these chunks gets named "index.[hash]" (or potentially any other duplicated names) due to how rollup names chunks – which makes it hard to identify what chunk it belongs to. I havent found any other way of avoiding this, other than renaming the culprits – but that would still be error prone.

Using this code, the output would be the content hashed index.[hash], which again would give index.[jshash].[csshash].css, but then it would atleast be uniquely identifiable.

Not sure if you have any other suggestions in order to solve this?

warlo commented 3 years ago

The PR checks should be fixed, but before doing that do you have any comments @Anidetrix? Would be nice to find a solution for this 👍

Anidetrix commented 3 years ago

Hi @hanswilw,

I'd imagine not everyone wants that, since people not necessarily connect CSS to JS they import it in. I think we should add additional placeholder for this instead, something like [jshash].

warlo commented 3 years ago

Right, I'll close the PR and maybe have a look when I have time :)