-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
cssModules localsConvention = 'camelCase' is not reflecting in nuxt app #7223
Comments
Thanks for your contribution to Nuxt.js!
Issues that are labeled as |
@tareq89 I was only able to do this by adding build: {
extend (config) {
config.module
.rules.find(({ test }) => test.toString() === /\.css$/i.toString())
.oneOf.find(({ resourceQuery }) => resourceQuery && resourceQuery.toString() === /module/.toString())
.use.find(({ loader }) => loader === 'css-loader')
.options.localsConvention = 'camelCaseOnly'
}
} May be it looks some wordy, but it works. Of course, it would be better if Nuxt provides references for loaders' options in context or in some other simplified config entity to prevent manually injection to complex webpack config. I tried doing something described in the first post (with |
@danielroe Thanks, now everything is simple and elegant: build: {
loaders: {
cssModules: {
localsConvention: 'camelCaseOnly'
}
}
} Hope it will be useful for users that will come here from Google, like me. |
Version
v2.12.2
Reproduction link
https://codepen.io/tareq89/pen/Yzywwbe
Steps to reproduce
In the nuxt.config.js file
build: {
extend: (config, ctx) {
ctx.loaders['cssModules'].modules.localIdentName = ctx.isDev ? '[name]__[local]' : '[hash:base64:10]'
ctx.loaders['cssModules'].localsConvention = 'camelCase'
}
}
What is expected ?
In the vue component, the css class 'Banner--red' should be generated like this.$style.banerrRed = 'Banner--red'
What is actually happening?
In the vue component, the css class 'Banner--red' is being generated like this.$style.['Banner--red'] = 'Banner--red'
Additional comments?
How this problem can be solved? it looks like configuring cssModule loader from nuxt.config.js is not working.
The text was updated successfully, but these errors were encountered: