This is a simple web server for auto browsersync.
Created
July 31, 2017 02:31
-
-
Save pjchender/9b3e913e77da81681182d956be5cd369 to your computer and use it in GitHub Desktop.
Gulp BrowserSync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp') | |
const browserSync = require('browser-sync').create() | |
// Static Server + watching scss/html files | |
gulp.task('serve', function () { | |
browserSync.init({ | |
proxy: 'http://localhost:3000/' | |
}) | |
gulp.watch('./../shopping-mall/app/**/*.{css,js,erb}', ['browser-reload']) | |
}) | |
gulp.task('browser-reload', function (done) { | |
browserSync.reload() | |
done() | |
}) | |
gulp.task('default', ['serve']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "pjchender-gulp-template", | |
"version": "0.0.6", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "gulp", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"browser-sync": "^2.18.8", | |
"gulp": "^3.9.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Watch everything below folder
The pattern for all files under all directories is usually
./src/less/**/*.*
or./src/less/**/*
, either should work.Generally speaking, it's better to match specific files extensions — even if they should all be the same — to prevent grabbing system files or other junk. In that case, you can do
./src/less/**/*.less
for just .less files, or something like.src/less/**/*.{less,css}
for both .less and .css files.