Created
June 14, 2014 16:09
-
-
Save beeblesox/69ad07ec3d025ca3aeca to your computer and use it in GitHub Desktop.
Minimal gulp file that will serve files from a public folder, open chrome for you, and live reload on changes
This file contains 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
var gulp = require('gulp'), | |
livereload = require('gulp-livereload'), | |
open = require('open'), | |
express = require('express'), | |
port = 80; | |
gulp.task('server', function(next){ | |
var server = express().use(express.static( __dirname + '/public' )).listen(port, next); | |
var portStr = port == 80 ? '' : ':' + port; | |
open("http://localhost" + portStr, "chrome"); | |
}); | |
gulp.task('default', ['server'], function(){ | |
var refresh = livereload(); | |
gulp.watch(['public/*.*', 'public/**/*.*']).on('change', function(file){ | |
refresh.changed(file.path); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm tired of struggling with these complex generators that give me so much crap I don't need (don't know how to use). I think I'll just skip generators and use a simple live reload script like this.