gulp-webserver
$ npm i -D gulp-webserver
var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var coffee = require('gulp-coffee'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var plumber = require('gulp-plumber'); var header = require('gulp-header'); var webserver = require('gulp-webserver'); gulp.task('html', function(done){ gulp.src('./src/index.html') .pipe(gulp.dest('./dest')) done(); }); gulp.task('img', function(done){ gulp.src('./src/img/*.png') .pipe(imagemin()) .pipe(gulp.dest('./dest/img')) done(); }); gulp.task('js', function(done){ gulp.src('./src/coffee/*.coffee') .pipe(plumber()) .pipe(coffee()) .pipe(concat('all.min.js')) .pipe(uglify()) .pipe(header('/* copry righ @hpscript */')) .pipe(gulp.dest('./dest/js')) done(); }); gulp.task('watch', function(done){ gulp.watch('./src/coffee/*.coffee', gulp.task('js')) gulp.watch('./src/*.html', gulp.task('html')) done(); }); gulp.task('webserver', function(done){ gulp.src('./dist') .pipe(webserver({ host:'192.168.34.10', livereload: true })); done(); }); gulp.task('default', gulp.series('html','img','js','watch','webserver'));
きた。livereloadが動かないと思ったら、htmlタグでないとダメのようね。
OK。では、sass + gulpの環境を考えましょう