Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement react static scss into project?

I am using static react template and need to implement scss. my git hub sample : https://github.com/PrasanthGokuldas/Test_ReactStatic.git i tried to add react-static-plugin-sass to package.json and included in static.config.js file as

plugins: ['react-static-plugin-sass']

but i am unable to access scss file to project.

like image 414
Prasanth Avatar asked Dec 06 '25 19:12

Prasanth


1 Answers

Once you have added react-static-plugin-sass using yarn or npm, you need to add it to the top of your plugins array (static.config.js) as follows:

plugins: [
    require.resolve('react-static-plugin-sass'),
    [
        require.resolve('react-static-plugin-source-filesystem'),
        {
            location: path.resolve('./src/pages'),
        },
    ],
    require.resolve('react-static-plugin-reach-router'),
    require.resolve('react-static-plugin-sitemap'),
],

Then all you need to do is start writing your Sass in your app.scss file and import app.scss in your App.js.

like image 76
Erik Höhmann Avatar answered Dec 08 '25 16:12

Erik Höhmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!