CSS Modules - exclude class from being transformed
Please do not use inline styles as someone else suggested. Stay away from inline styles as much as you can because they can cause unnecessary re-renders.
You should use global
instead.
.my-component {
:global {
.external-ui-component {
padding: 16px;
// Some other styling adjustments here
}
}
}
https://github.com/css-modules/css-modules#usage-with-preprocessors
Also, I recommend using camel case style names which is the preferred way for css-modules.
So your class name would be : .myComponent { ... }
And you can use it in your code as
<div className={ styles.myComponent } >
If you wanted to add more styles , you can use the array.join(' ')
syntax.
<div className={ [ styles.myComponent, styles.anotherStyle ].join(' ') } >
This is cleaner!
Setting modules to false in webpack config breaks all css
I solved this issue by replacing modules:false
with
modules: {
localIdentName: IS_DEV ? '[local]' : '[hash:base64:5]'
},
This makes it so that when running in dev mode (not production), the css classnames are visible and continue to work the same as in production. For more info, check out https://github.com/webpack-contrib/css-loader#modules
Related Topics
Nth-Child to Alternate by 2 Rows
Scale Image with CSS to Both Width and Height to Scale
Is There an Ideal Size for Background Images
Bootstrap 3 - Add an Asterisk to the Input on the Same Row
Stacking Divs on Top of Each Other
How to Stretch The Background Image to Fill a Div
How to Fill 100% of Remaining Width
Vertical-Align Not Working with Xhtml 1.0 Transitional Doctype
Stop Link's :Before Content from Being Underlined by Rule Applied to the Link
In Firebug, How to Tell What Is Overriding a Style
How It Works CSS Font-Weight Values
Change Colour Navbar Header Ionic 2
Remove Conflicting Styling - Bootstrap & Google Custom Search
CSS Media Query to Handle New High Resolution Mobiles Whilst Ignoring Tablets