javascript - Watching styles and running a nodemon server with gulp -


firstly, aware there few questions on topic, i've tried use task structure , fixes, nothing working me...

i'm watching styles , i'll add scripts , images on later.

here gulpfile.js:

'use strict'; var gulp = require('gulp'); var sass = require('gulp-sass'); var autoprefixer = require('autoprefixer'); var cssnano = require('gulp-cssnano'); var postcss = require('gulp-postcss'); var watch = require('gulp-watch'); var sourcemaps = require('gulp-sourcemaps'); var lost = require('lost'); var nodemon = require('gulp-nodemon'); var config = require('./config.js');  // getting app name var contract = config.contract;  // directories var dirs = {     stylessrc: '_assets/' + contract + 'styles/scss/**/*.scss',     stylesdest: '_assets/' + contract + 'styles/css' };  // styles task autoprefixer , lostgrid gulp.task('styles', () => {     return gulp.src(dirs.stylessrc)         .pipe(sass())         .pipe(postcss([             autoprefixer({                 browsers: [                     "android 2.3",                     "android >= 4",                     "chrome >= 20",                     "firefox >= 24",                     "explorer >= 8",                     "ios >= 6",                     "opera >= 12",                     "safari >= 6"                 ]             }),             lost()         ]))     .pipe(gulp.dest(dirs.stylesdest)) });  // watch styles gulp.task('watch', function(){      gulp.watch(dirs.stylessrc, ['styles']); })  // nodemon server gulp.task('serve', function(){     nodemon({'script': 'server.js'}); });  // start server , watch development gulp.task('default', ['serve', 'watch']); 

i've tried few iterations, current 1 seems work, not watch. here terminal output:

npm run start gulp using gulpfile ~/development/projecttitle/gulpfile.js starting 'serve'... finished 'serve' after 36 ms starting 'watch'... finished 'watch' after 9.64 ms starting 'default'... finished 'default' after 23 μs [nodemon] 1.11.0 [nodemon] restart @ time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node server.js` server listening on port 8086 

and nothing happens when save sass file changes.

any advice welcome, thanks!

this path levels mark commented above. need watch prefixed , trailing slashes in url paths.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -