Search code examples
node.jssassexpress-generator

Change scss file location with express-generator not working


So I have followed the instructions to scaffold a new project with express-generator latest version. Upon creation, I have done the npm install and everything went ok. Under the express-generator options, I passed pug as the view engine and sass as the style. Once the project has been created I found that the .css files are next to the .scss files so I made new folder under the public folder called sass to store all my .scss files, then I change the src path in the app.js file to public/sass, and I only have two files under the sass folder the one that the generator created and other with one variable color defined to test the import. But as soon as I moved the files into this new location changes in variable color are not being made, if I move the files back to the original location they work, can someone tell me what is going on?

app.use(sassMiddleware({
  src: path.join(__dirname, "public", "sass"),
  dest: path.join(__dirname, "public"),
  indentedSyntax: false, // true = .sass and false = .scss
  sourceMap: true
}));

Solution

  • sassMiddleware is actually looking for a specific folder structure so when I change the public directory for sass, it is expecting inside the sass folder another folder called stylesheets, and inside this new folder I can put any scss files, and now it is working, thanks to all.