Created
July 9, 2015 08:09
-
-
Save sosnovskyas/8ae14ec69b4d9b6996c8 to your computer and use it in GitHub Desktop.
default gulp setting
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
var gulp = require("gulp"); | |
var connect = require("gulp-connect"); | |
var opn = require("opn"); | |
var jade = require('gulp-jade'); | |
//запускаем локальный сервер | |
gulp.task('connect', function() { | |
connect.server({ | |
root: 'app', | |
livereload: true, | |
port: 8888 | |
}); | |
opn('http://localhost:8888'); | |
}); | |
//работа с HTML | |
gulp.task('html', function () { | |
gulp.src('./app/*.html') | |
.pipe(connect.reload()); | |
}); | |
//работа с CSS | |
gulp.task('css', function () { | |
gulp.src('./app/css/*.css') | |
.pipe(connect.reload()); | |
}); | |
//работа с JS | |
gulp.task('js', function () { | |
gulp.src('./app/js/*.js') | |
.pipe(connect.reload()); | |
}); | |
// работа с шаблонами JADE | |
gulp.task('jade', function() { | |
var YOUR_LOCALS = {}; | |
gulp.src('./app/jade/index.jade') | |
.pipe(jade({ | |
locals: YOUR_LOCALS, | |
// красивый (не ужатый) вывод | |
pretty: true | |
})) | |
.pipe(gulp.dest('./app/')) | |
}); | |
//WATCHER | |
gulp.task('watch', function () { | |
gulp.watch(['./app/*.html'], ['html']); | |
gulp.watch(['./app/css/*.css'], ['css']); | |
gulp.watch(['./app/js/*.js'], ['js']); | |
gulp.watch(['./app/jade/*.jade'], ['jade']); | |
}); | |
//DEFAULT | |
gulp.task('default', ['connect', 'watch']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment