Created
February 24, 2015 10:02
-
-
Save nurfaizfoat/5a35fb017672cc9c0c4e to your computer and use it in GitHub Desktop.
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'); | |
var plumber = require('gulp-plumber'); | |
var webserver = require('gulp-webserver'); | |
var opn = require('opn'); | |
var sourcePaths = { | |
html: ['*.html'] | |
style: ['css/*.css'] | |
images: ['img/**/*.jpg', 'img/*.jpg'] | |
}; | |
var server = { | |
host: 'localhost', | |
port: '8001' | |
} | |
gulp.task('webserver', function() { | |
gulp.src( '.' ) | |
.pipe(webserver({ | |
host: server.host, | |
port: server.port, | |
livereload: true, | |
directoryListing: false | |
})); | |
}); | |
gulp.task('openbrowser', function() { | |
opn( 'http://' + server.host + ':' + server.port ); | |
}); | |
gulp.task('watch', function(){ | |
gulp.watch(sourcePaths.html, ['html']); | |
gulp.watch(sourcePaths.style, ['styles']); | |
gulp.watch(sourcePaths.images, ['images']); | |
}); | |
gulp.task('default', ['webserver', 'watch', 'openbrowser']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment