-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Shortening CSS classes with css-modules #3434
Comments
This is something that the Parcel docs talk about in the CSS features, https://parceljs.org/css.html You could either use cssnano or PostCSS to minify/transform your CSS. If this is a feature request, since the Parcel team launched the v2 pre-release, they are now focusing on it, so you probably won't get a favorable response concerning something for the v1.
Though, this could probably be done with the plugins in the v1, I can't really give you directions as my experience with plugins on the v1 has been limited to one small plugin. If you want however to maybe, try and test with the v2 plugin api, if i'm not mistaken, you should look at optimisers. |
Okey, I've managed to use postcss to achive what I want but there is still a thing that bothers me, how can I set a custom function for generateScopedName like shown here (Quote from here)
|
@portocala You should be able to use any of the files types to define the postcss config as listed here: https://github.com/parcel-bundler/parcel/blob/master/packages/core/parcel-bundler/src/transforms/postcss.js#L26 For your case the One hint: Best do not implement the line number into your custom class name resolution as this might cause duplicate lines of CSS when using |
Back after a long time, sry, been busy... This is my {
"modules": true,
"plugins": {
"autoprefixer": true,
"postcss-modules": {
"generateScopedName": "[sha1:hash:base64:5]"
},
}
} It seems to be a similar issue to #972 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
β Question
I think the context says it.
π¦ Context
I want to rebuild my css file with shorter classes to reduce overall file size when delivering through the website. So far I've been able to achive this with babel-plugin-css-modules-transform but it kinda bothers me while developing because I lose the hotreload. More info on the subject here
π» Code Sample
here
π Your Environment
npm@6.9.0
Node@10.16.1
parcel-bundler@1.12.3
Windows 10 - 10.0.17763 Build 17763
The text was updated successfully, but these errors were encountered: