Search code examples
typescriptsasshandlebars.jsnode-sass

how to properly compile files in node js project


created a small projec. I am using sass, node js, typescript, handlebars in it.

my script to compiling project

"start": "nodemon index.ts",
"build": "tsc --noEmit false && sass -w src/:dist/css/"

it works almost

All files are compiled as I need, I miss moving the handlebars file to the main compilation folder (dist)

how to organize it?

enter image description here


Solution

  • for sass i personally use this simple build process build process

    package.json

    "scripts": {
        "watch:sass": "sass --watch sass/main.sass  dist/css/style.css",
        "compile:sass": "sass --no-source-map sass/main.sass  dist/css/style.comp.css",
        "concat:css": "concat -o dist/css/style.concat.css dist/css/icon-fonts.css dist/css/style.comp.css",
        "prefix:css": "postcss --use autoprefixer  -b 'last 10 versions' dist/css/style.concat.css  -o dist/css/style.prefix.css",
        "compress:css": "sass --style compressed dist/css/style.prefix.css dist/css/style.css ",
        "build:css": "npm-run-all compile:sass concat:css prefix:css compress:css "
      },
      "devDependencies": {
        "autoprefixer": "^10.4.2",
        "concat": "^1.0.3",
        "npm-run-all": "^4.1.5",
        "postcss-cli": "^9.1.0",
        "sass": "^1.49.4"
      },