Add SASS in webpack React Redux project
This guide will simply cover to embed SASS support in React.js project.
First, install node-sass and sass-loader npm packages.
Yarn: yarn add sass-loader --dev yarn add node-sass NPM: npm install node-sass npm install sass-loader --save-dev
Then add this in your webpack loaders. It will test for .scss files apply the sass loader. It also has included hashing.
{ test: /\.scss$/, loader: 'style!css!sass?modules&localIdentName=[name]---[local]---[hash:base64:5]' }
After this, you will need to add the base .scss style file to the entry point of webpack. I always use a base style file including all the other stylesheets in it. My file structure is as follows
assets -/ styles -/ common -/ app-header.scss ... styles.sccs
And I import the app-header.scss in styles.scss.
@import "./common/app-header";
Then add entry point in webpack.
entry: [ 'babel-polyfill', './assets/styles/styles.scss', './src/app.js', ],
And also add this line in the plugins too. This should be changed to the preference of production and dev mode too. Please refer https://github.com/webpack-contrib/extract-text-webpack-plugin for more details. The extract-text plugin will be doing the description on its wiki.
“It moves all the required *.css
modules in entry chunks into a separate CSS file. So your styles are no longer inlined into the JS bundle, but in a separate CSS file (styles.css
). ”
plugins: [ new ExtractTextPlugin("styles.css"), ]
Done. Now you can add any styles in the styles folder and import it in styles.scss.
20 COMMENTS
how to get viagra prescription
list of otc allergy medications common prescription allergy pills does benadryl make you sweat
infant stomach cramp prescription medication clozapine sale
does pancreatitis cause stomach pain buy bactrim 480mg online
buy prednisolone without a prescription order omnacortil 10mg sale omnacortil 10mg oral
order doxycycline pills brand doxycycline 200mg
Your positivity and optimism are contagious It’s impossible to read your blog without feeling uplifted and inspired Keep up the amazing work
I completely agree with your perspective on this topic It’s refreshing to see someone presenting a balanced and thoughtful viewpoint
order amoxiclav for sale amoxiclav tablet oral augmentin 1000mg
omnacortil 5mg pills omnacortil 10mg generic order prednisolone 40mg for sale
buy levothyroxine tablets how to get synthroid without a prescription order generic levothyroxine
Discover Prostadine, your go-to supplement for maintaining optimal prostate health as you age. With nine natural ingredients dedicated to protecting and enhancing prostate well-being, this formula is your proactive solution for preventing issues and ensuring a healthy prostate as you grow older. Prioritize your prostate health with Prostadine for a vibrant, worry-free future.
roulette game online slot games gambling casino online
crestor 10mg over the counter buy zetia 10mg without prescription buy zetia 10mg sale
buy acillin without prescription buy penicillin tablets amoxil us
Your posts always provide me with a new perspective and encourage me to look at things differently Thank you for broadening my horizons
Your posts always provide me with a new perspective and encourage me to look at things differently Thank you for broadening my horizons
I couldn’t stop scrolling and reading, your content is truly one-of-a-kind. Thank you for all the time and effort you put into creating such amazing content.
Your article helped me a lot, is there any more related content? Thanks!
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.