-
-
Notifications
You must be signed in to change notification settings - Fork 201
ux-react: add CSS from within components #1370
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
Comments
This is my full config as per
|
Hey @nerdess, Let's continue here instead of #701. When you said that you tried using What happens if you remove the import Toolbar from './toolbar/Toolbar';
import Grid from './grid/Grid';
import styles from './calendar.scss?module';
const Calendar = () => {
return (
<div className={ styles.tsCalendar }>
<Toolbar />
<Grid />
</div>
)
}
export default Calendar; |
Yep, I kicked out Regarding your question with First, because I use Typescript, I added some styles.d.ts so it would not complain about the ?module or .css/.scss in general:
Then going back to my React Component, I did this:
The When looking into my Encore.getWebpackConfig() I was wondering, why
|
Here is a working example : https://github.com/Lyrkan/symfony-typescript-react-css-modules It generates a CSS file similar to: body {
background-color: lightgray;
}
.hello_tdNlH {
background-color: red;
} By default the CSS loader uses named exports and does not seem to export If you want to use |
@Lyrkan I do not know how much to thank you. The example you put on Github was the perfect blueprint that I needed for my code forensics. It turned out the problem was not my webpack config (!!!!), it was that the CSS which was generated through Javascript was not added to Before:
Now:
Everything works like magic now. I am so happy! |
Glad you figured it out :) |
I am playing with
ux-react
on a Symfony project that useswebpack-encore
.It works fine, but there is one problem: importing CSS within a React component does not work?!
React component
webpack.config.js
Basically, I need a simple
import './calendar.scss';
to work within the folder where React sits (assets/react).Any hints would be appreciated!
The text was updated successfully, but these errors were encountered: