Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An option to "do nothing"? i.e. transform in place #408

Open
43081j opened this issue Dec 26, 2021 · 0 comments
Open

An option to "do nothing"? i.e. transform in place #408

43081j opened this issue Dec 26, 2021 · 0 comments

Comments

@43081j
Copy link

43081j commented Dec 26, 2021

If you use postcss directly (via its CLI for example), it is a simple transform: input -> postcss (transform) -> output. It isn't relevant what format the input is in, or where it lives. As long as postcss can be told how to read it, it can transform it and be told how to write it.

This plugin however, seems to do nothing like that, having two strategies:

  • Extract CSS via postcss into a separate CSS file
  • Extract CSS via postcss into the <head> tag

Curious why this design has been chosen as it severely limits what postcss is for.

I don't want to extract anything, i want to run postcss against my input (sources) and produce an output (transformed sources). Having that happen in rollup is ideal, but that is all. No 'extraction', no 'injection', etc.

PostCSS already does this out of the box

In webpack projects, that is exactly how postcss integration works. You can tell webpack to pass the current inputs through postcss and bundle the outputs. If you want to pull the CSS out into files/chunks, thats a decision completely unrelated to postcss but rather for the bundler or a separate css plugin.


Basically what im asking for is extract: false, inject: false. I don't want it to do anything other than pass the file through postcss and use the output as the new file. From there, bundle it, split it out, whatever.

Otherwise i can't run postcss against embedded CSS (e.g. css inside JS files).

Is this plugin just outdated? since postcss may not have had custom syntax support back then.

IMO this is doing the job of two plugins and definitely shouldn't. webpack got it right:

  • A plugin to pass inputs through postcss and replace them with the output
  • A plugin to store CSS files alongside bundle output and update any references to point at their new paths

cc @egoist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant