1

I import all my SCSS styles into a index.scss file using @import. This works fine when I build css manually using npm run build-css:

"scripts": {
    //Other scripts
    "build-css": "node-sass src/scss/index.scss -o dist/css/",
  }

When I run node-sass in watch mode it updates the /dist/css/index.css just fine but also creates the css in the dist folder for the original scss file that I edited and imported in the src/scss/index.scss

"scripts": {
        //Other scripts
        "build-css": "node-sass src/scss/index.scss -o dist/css/",
        "watch-css": "npm run build-css && node-sass src/scss/index.scss -o dist/css/ -w src/scss/**/*.scss --include-path src/scss/imports/*.scss"
      }

My src/scss/index.scss looks as follows:

@import "./imports/bootstrap.min";
@import "./imports/contacts";

So, if I edit contacts.scss in watch mode node-sass updates the ./dist/css/index.css but also creates an extra contacts.css in the dist/css folder.

Is there a way I can have node-sass update only the dist/css/index.css and not build the imports into the dist folder?

JSNinja
  • 705
  • 6
  • 19

1 Answers1

0

Change the filename contacts.scss to _contacts.css; the compiler ignores the underscored files.

Das_Geek
  • 2,775
  • 7
  • 20
  • 26
Edwin
  • 1