classnames-loader | Webpack loader to automatically bind css | Build Tool library
kandi X-RAY | classnames-loader Summary
kandi X-RAY | classnames-loader Summary
Webpack loader to automatically bind css-modules to classnames
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of classnames-loader
classnames-loader Key Features
classnames-loader Examples and Code Snippets
Community Discussions
Trending Discussions on classnames-loader
QUESTION
React beginner here. My app uses create-react-app, and I'm pulling in react-slick for a carousel. I'm trying to follow the directions that are provided in the setup for react-slick, but the following doesn't work for me:
@import "~slick-carousel/slick/slick.css";
@import "~slick-carousel/slick/slick-theme.css";
I get the following error:
./src/components/Homepage.scss
Module not found: Can't resolve '~slick-carousel/slick/slick.css' in '/Users/simon/Dev/frischideas/site-new/src/components'
It works if I add the css to index.html from the CDN, but I'd rather avoid that network call, as I believe it's affecting the rendering of the page on initial load.
I tried following the instructions for configuring create-react-app to use relative paths, but that wasn't working for me either. Maybe I'm completely misunderstanding, but I thought the ~ notation would allow me to import scss from a package in /node_modules.
Any suggestions/clarification would be greatly appreciated.
Update: adding the setup from my webpack.config file (most of which is the default from create-react-app).
...ANSWER
Answered 2018-Aug-06 at 10:23It fails because you are importing css modules in your app, and styles from slick are not applied because they are getting cached. I've fixed it in my project like below:
In your style.scss files put this
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install classnames-loader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page