38 questions
2
votes
3
answers
537
views
How to use subsequent-sibling selector in React CSS modules
How would I write and call this CSS in React CSS Modules?
.is-invalid ~ .validationError {
display: inline !important;
}
Calling styles.validationError does not work.
1
vote
1
answer
924
views
babel-plugin-preprocessor not working in React 18 with typescript
I want to use the babel-plugin-preprocessor to remove console.log() calls from my React application. My application was created using create-react-app and uses Typescript.
I'm following the ...
-1
votes
1
answer
163
views
Passing css module as prop using babel-plugin-react-css-modules
I'm using babel-plugin-react-css-modules and need to pass classes via props to React components, as such:
import "./style.css"
// Works
<div styleName="a" />
// Does not ...
2
votes
1
answer
2k
views
Different hashes between css-loader and babel-plugin-react-css-modules
I trying to setup own simple webpack config with css-modules. And problem is that I getting different hashes by css-loader and babel css modules plugin in css classes names.
const path = require("...
3
votes
1
answer
3k
views
How do react-css-modules (babel) and css-loader (webpack) work together?
When using webpack and babel together, one needs to configure both in order to use React CSS Modules. For example:
webpack.config.js will need a rule like this:
{
// Translates CSS into CommonJS ...
2
votes
0
answers
107
views
How to config babel-plugin-react-css-modules with nextjs 10 (with scss)?
Is there a straightforward guide or step-by-step solution to config babel-plugin-react-css-modules with the create-next-app (v10+)?
2
votes
1
answer
566
views
Incorrect className of child component using babel-plugin-react-css-modules
I'm trying to use babel-plugin-react-css-modules in existing React project. Most of components work just fine, however there is a problem with 'passing' style to child components.
I have some parent ...
4
votes
0
answers
986
views
Import Attribute Selectors from CSS Module
I am working on a react hook that will load styles from an (s)css module based on the props passed to a component. It looks something like this:
import { useState, useEffect } from 'react';
export ...
1
vote
1
answer
3k
views
How to override external module class with css module pattern in react
I want to override a external module cssclass locally for a component
In my code
import `style` from './style.module.css' // this is local css module
import `ExternalComponent` from '...
0
votes
2
answers
723
views
ClassName props is missing in object type. Flow and CSS Modules
I have initialized a React Native app with the CLI quickstart. The only thing I have edited is that I use CSS Modules for styling the component (note: className in stead of style). I want to typecheck ...
2
votes
1
answer
525
views
Material-UI - Support babel-plugin-react-css-modules and rtl app
material-ui: v4.8.2
react: v16.12.0
babel-plugin-react-css-modules with rtl app - I thought to use injectFirst but then I get a warning:
Material-UI: you cannot use the jss and injectFirst props at ...
1
vote
1
answer
3k
views
babel-plugin-react-css-modules does not change class name in style tag
I want to use babel-plugin-react-css-modules to create unique class names, so I did a PoC: I ejected create-ract-app, then I add babel-plugin-react-css-modules to plugins in package.json:
"babel": {
...
0
votes
0
answers
756
views
vue js css modules are giving the same names to elements in each rendering
I am working on a vue project and I made CSS as modules so that I can assign different class names to different elements.
But the component containing the CSS module is rendering multiple times like:
...
4
votes
2
answers
2k
views
Could not resolve styleName
I'm using scss modules in my react app but every time I change a styleName, I get the error Could not resolve styleName during hot reloading. If I don't have any corresponding styles for the styleName,...
0
votes
1
answer
1k
views
Extending CSS classes of frameworks with css modules
I am currently developing a react project and in some cases have to extend CSS classes of frameworks like bootstrap with attributes. For example, I want to change the background color of this class (...
4
votes
2
answers
3k
views
Remove unused CSS classes from frameworks like bootstrap in a react project
We are currently developing a react project using webpack and babel and would like to have automatically removed unused CSS classes in the CSS frameworks Bootstrap and AdminLTE 2 which we use.
In the ...
4
votes
0
answers
744
views
Error: Could not resolve the styleName 'x' with babel-plugin-react-css-modules and postcss-import
The Issue
Recently I have switched from the deprecated react-css-module to babel-plugin-react-css-modules to use CSS Module in a React project and encountered the issue that it is not able to resolve ...
4
votes
1
answer
9k
views
How to setup babel-plugin-react-css-modules in create-react-app?
I really like the separation of className and styleName that babel-plugin-react-css-modules offers for global and local styles respectively, but have had some trouble getting the plugin to work with ...
2
votes
0
answers
200
views
SASS nested classes with babel-plugin-react-css-modules
I'd like to turn the <label> in this div red:
<div styleName="foo">
Some green text
<label styleName="bar">Bar</label>
</div>
My associated SCSS file looks like:
....
4
votes
1
answer
1k
views
Can I tell style-loader to load my global css before my CSS Modules?
Most of my site is using Bulma classes for some of my global UI styling, and I'd like to continue to use those classes within my components, but also be able to define CSS Modules for those components ...
0
votes
1
answer
402
views
babel-plugin-react-css-modules does not support background images
After using css-modules, the background-image in scss will not work.
Please, How to configure it correctly?
repo: https://github.com/pdsuwwz/Antd-app
Error:
ERROR in ./src/script/...
4
votes
3
answers
1k
views
`babel-plugin-react-css-modules` Typescript Type Checking
I am using babel-plugin-react-css-modules. It add the styleName property to HTML elements. Typescript doesn't recognize this property. I am pretty sure I need to extend something but nothing I have ...
2
votes
1
answer
3k
views
React - Use Bootstrap globally with css modules
Pretty new to react and all that stuff, so I need some help here. I recently added the https://github.com/gajus/babel-plugin-react-css-modules plugin to my project. After some troubles I got it to ...
4
votes
4
answers
2k
views
Unable to skip 3rd party library CSS from CSS-Module transformation
I am trying CSS Modules for the first time with React and Webpack and I came across at least three ways to achieve it:
css-loader
react-css-modules
babel-plugin-react-css-modules
I went with babel-...
5
votes
0
answers
491
views
React CSS Modules, babel-plugin-react-css-modules with electron-compile no webpack
I am trying to start using react-css-modules w/ babel-plugin-react-css-modules. At present I have an electron-forge application running react.
My .compilerc looks like the following:
{
"env": {
...
2
votes
2
answers
2k
views
Import Library Stylesheets With Babel-Plugin-React-Css-Modules
I am trying to include another library's css for their component in my own application. For reference, I am trying to use this data table library: https://github.com/filipdanic/spicy-datatable.
In ...
1
vote
0
answers
239
views
babel-plugin-react-css-modules cannot resolve scss files using aliased path in webpack
I am trying to use babel-plugin-react-css-modules in a react app with webpack and SSR. However the aliased import statements shows Cannot find module error in webpack.
If i use relative path for the ...
0
votes
1
answer
609
views
Use original className in console when using css modules
I am using babel-plugin-react-css-modules. This is my configuration isnide of webpack.
devtool: 'source-map',
{
test: /\.local\.(css|scss)$/,
use: [
'style-...
0
votes
1
answer
54
views
Installation with Create React App
I'm sorry for asking what may be an obvious question to most, but I'm lost. I have created a react project with create-react-app. I want to add a third party library (Ant Design UI Framework) that ...
1
vote
0
answers
619
views
babel-plugin-react-css-modules aren't outputting styles
I'm using babel-plugin-react-css-modules and it seems to be creating the className/styleName, but for some reason it isn't outputting the CSS so that it can be read by the module.
Here's my ...
6
votes
2
answers
3k
views
Unable to import CSS with "babel-plugin-react-css-modules" - get "ParseError: Unexpected token"
Please see https://github.com/gajus/babel-plugin-react-css-modules/issues/162 for full description of issue.
Git repo = https://github.com/basher/react-no-webpack
This is a simple POC / scaffold for ...
0
votes
1
answer
4k
views
CSS Modules and multiple class names with tags
What do I do when I run across this?
<div className="ui row myClass">
If myClass was the only class I would import the relevant style sheet and do this:
<div className={styles.myClass}>
...
0
votes
1
answer
618
views
Module build failed: SyntaxError: Unexpected token ..." after upgrade babel-plugin-react-css-modules
I have started to get the error since upgrade babel-plugin-react-css-modules from 2.8.0 to 3.3.2:
> node ./server.js
Listening at ipmc-dev11.be-md.ncbi.nlm.nih.gov:3000
Hash: a9c93503d372d94f4710
...
7
votes
1
answer
3k
views
babel-plugin-react-css-modules is not matching styles with styleName
Issue
I am trying to use babel-plugin-react-css-modules in my React project for better performance as opposed to React CSS Modules.
However, the styles are being not applied correctly.
Cause
The ...
0
votes
1
answer
633
views
babel-plugin-react-css-modules import is not work in less-loader
i try use @import is not working。
// a.less
.hello{width:100px;height:100px;background:blue;}
// index.less
@import './a.less'
// App.jsx
import './index.less';
<div styleName="...
1
vote
1
answer
594
views
Pass className as other prop than styleName
How do I pass a CSS module class name as a different prop than styleName?
import './MyStyles.css'
<ThirdPartyComponent
styleName='this-works'
activeClassName='i want to pass my css module ...
4
votes
0
answers
1k
views
Setting up babel-plugin-react-css-modules with webpack 3.5.1
I'm trying to set up babel-plugin-react-css-modules for webpack 3.5.1 (ejected from create-react-app).
This is my webpack.config.dev.js:
'use strict';
const autoprefixer = require('autoprefixer');
...
4
votes
2
answers
3k
views
Apply CSS Module class name by directly accessing the DOM
I have a component that makes use of CSS-Modules, by means of the babel-plugin-react-css-modules plugin.
At some points during the lifetime of the component I want to be able to calculate new ...