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

Adds a --css-modules option #370

Merged
merged 7 commits into from
Feb 9, 2020
Merged

Adds a --css-modules option #370

merged 7 commits into from
Feb 9, 2020

Conversation

maraisr
Copy link
Contributor

@maraisr maraisr commented Apr 1, 2019

With this PR, I aim to add an option to the cli, that'll allow developers using css-modules to bundle their things, using this. I gather that this would be solved in the future with a config file, or convention.

I aim for something like microbundle entry.js --css-modules that when ran to produce this, as yeah, probably not many people want this as the default. And also makes this backwards compatible.

@maraisr
Copy link
Contributor Author

maraisr commented Apr 1, 2019

Starting this draft here - the snapshots are failing for me, even at a clean clone. So will investigate. Also wanting to confirm a few things, and maybe clean that config setting thing up a bit. Also, the jest fixtures are a bit awkward for this. So going to also split out cli args into potentially separate tests, that run "build commands" from the package json in its own fixture or something. #minddump 💯

@maraisr maraisr marked this pull request as ready for review April 1, 2019 22:33
@maraisr
Copy link
Contributor Author

maraisr commented Apr 1, 2019

The unit tests for esnext-ts are failing, for me locally as well. I can't even get master to snapshot without failing on that test.

It seems there is no lock file for this project, do we think that maybe one of the dependants (TypeScript 3.4) could have caused issues? Master hasnt built and ran in over 10 days?

I believe this issue to be resolved post #371

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@maraisr
Copy link
Contributor Author

maraisr commented Apr 5, 2019

@developit thanks for that - the PR has been updated! 🚀

@transitive-bullshit
Copy link
Contributor

transitive-bullshit commented Apr 17, 2019

It'd be great for this to be added to microbundle, but either way the ability to use *.module.css to enable CSS modules with the current version isn't easy to find or figure out. (searching this project for "css modules" yields zero relevant results aside from this PR)

I'd love to make sure the docs get updated accordingly with a note about CSS module support. Happy to send a PR once this gets merged.

@maraisr
Copy link
Contributor Author

maraisr commented Apr 17, 2019

if this ever gets merged ;) @transitive-bullshit

Copy link

@hbroer hbroer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i find only one test for three possible flag values (null, true, false)

@LeoVS09
Copy link

LeoVS09 commented Dec 25, 2019

Guys, we want to move our projects on microbundle, but cannot do it without css modules. Are you stop developing this feature?

@maraisr
Copy link
Contributor Author

maraisr commented Jan 13, 2020

What is left to get this across the line?? @developit @ForsakenHarmony @transitive-bullshit

Its just docs yeah?

src/index.js Outdated Show resolved Hide resolved
@ForsakenHarmony
Copy link
Collaborator

Sorry about the delays, mental health not doing so well

But yeah would be great adding something to the readme

@maraisr
Copy link
Contributor Author

maraisr commented Feb 7, 2020

Hi @ForsakenHarmony

I have updated this PR, with a focus on readability. Wrote some docs on how to consume this, and also a better explanation on the different use cases, and their outcomes.

One change however is, to treat .module.css as modules by default, rather than the current implementation where nothing is a module.

@hbroer I wrote tests for all avenues.

I will however note, that current the --css-modules null test, is incorrect. Because there is no way pass scope names to the underlying plugin, without also making it behave as though it was a --css-modules true. The comment around what the scope names will be will be accurate, and am raising a PR to the plugin to fix this. See below as to why.

https://github.com/egoist/rollup-plugin-postcss/blob/3fc6c44e7fbd287b1a295d5e3770e3e6cbaa7731/src/postcss-loader.js#L75-L97

A simple solution for now, would be to not pass the scopeName config when the option is null.

@ForsakenHarmony ForsakenHarmony merged commit 5100c7b into developit:master Feb 9, 2020
@VincentCharpentier
Copy link

Thanks for this feature 👍

Is it possible to have it in a release soon ?

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

Successfully merging this pull request may close these issues.

7 participants