Normally you dont render Sass manually with a npm command. Integrate Sass in your webserver and render it when the server starts and your watcher programm recognize changes in the code (nodemon, Webpack hot module, etc.)
Here is an example for an expressJs server:
https://stackoverflow.com/a/26277894/6564085
Let me quote swervos' answer from the link to save the snippet in this answer:
var connect = require('connect');
var sass = require('node-sass');
var srcPath = __dirname + '/sass';
var destPath = __dirname + '/public/styles';
var server = connect.createServer(
sass.middleware({
src: srcPath,
dest: destPath,
debug: true,
outputStyle: 'expanded',
prefix: '/styles'
}),
connect.static(__dirname + '/public')
);
If you want to use Webpack heres a webpack version:
https://stackoverflow.com/a/46059484/6564085
let me quote Arnelle Balane's for it.
{
test: /.scss$/,
use: ExtractTextPlugin.extract({
fallbackLoader: "style-loader",
use: [{
loader: 'css-loader'
}, {
loader: 'sass-loader',
options: {
outputStyle: 'expanded'
}
}]
})
}
More information here: https://www.npmjs.com/package/sass-loader