Skip to content

Instantly share code, notes, and snippets.

@beeblesox
Created June 14, 2014 16:09
Show Gist options
  • Save beeblesox/69ad07ec3d025ca3aeca to your computer and use it in GitHub Desktop.
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
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);
});
});
@beeblesox
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment