Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load Gulp and your plugins
- var gulp = require('gulp'),
- connect = require('gulp-connect'),
- stylus = require('gulp-stylus'),
- plumber = require('gulp-plumber');
- var paths = {
- styles: 'src/stylus/**/*',
- javascript: 'src/js/**/*',
- html: '*.html'
- };
- // Connect task
- gulp.task('connect', connect.server({
- root: __dirname + '/',
- port: 5000,
- livereload: true,
- open: true
- }));
- // HTML task
- gulp.task('html', function () {
- gulp.src('*.html')
- .pipe(connect.reload());
- });
- // Stylus task
- gulp.task('stylus', function () {
- gulp.src('src/stylus/*.styl')
- .pipe(plumber())
- .pipe(stylus({
- use: ['nib'],
- set: ['compress']
- }))
- .pipe(gulp.dest('assets/css'))
- .pipe(connect.reload());
- });
- var uglify = require('gulp-uglify');
- gulp.task('uglify', function() {
- return gulp.src('src/js/*.js')
- .pipe(uglify())
- .pipe(gulp.dest('assets/js'));
- });
- // Watch task
- gulp.task('watch', function () {
- gulp.watch(paths.styles, ['stylus']);
- gulp.watch(paths.javascript, ['uglify']);
- gulp.watch(paths.html, ['html']);
- });
- // Set 'gulp server' for development
- gulp.task('default', ['connect', 'uglify', 'stylus', 'watch']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement