0

So I am trying to create only css files or only js files at a time from the index.js file, which import few react component.

.
├── index.js
    ├── Header
        ├── index.js
        └── styles.scss
    └── Body
        ├── index.js
        └── styles.scss
    └── Footer
        ├── index.js
        └── styles.scss
    ├── Common
        └── Button
            ├── index.js
            └── styles.scss
        └── Label
            ├── index.js
            └── styles.scss

Now how do I create two different task npm run build:js and npm run build:scss to get js and css differently? Sometimes I just need to change the styles, but I had to a build for js as well. To prevent that I am trying this out.

EDIT1 - There's one more thing I forgot to add, All these Header, Body, Footer components imports different molecule level components like Button, Label. At the end the outcome expected is

.
 ├── Header.js
 ├── Header.scss
 ├── Body.js
 ├── Body.scss
 ├── Footer.js
 └── Footer.scss
Subhendu Kundu
  • 3,618
  • 6
  • 26
  • 57
  • that is not a proper task for webpack. You better run a task runner(gulp) instead. – PlayMa256 Oct 23 '18 at 19:57
  • 1
    Why not just use the `sass` CLI to build your SCSS outside of Webpack? – Adam Oct 23 '18 at 20:18
  • Thanks a ton @PlayMa256 Well, I was thinking about a task runner but @adam got a good point, running build using sass as I dont wanna introduce new task runner. ( Though I am open to any, if it solves the task). But @adam, how would you add the entry point to ```index.js``` to sass cli? – Subhendu Kundu Oct 24 '18 at 09:49

0 Answers0