Skip to content

Instantly share code, notes, and snippets.

@jeremy-brenner
Created August 15, 2016 19:07
Show Gist options
  • Save jeremy-brenner/bcb33e2348576fb01e3a7a1328ec8892 to your computer and use it in GitHub Desktop.
Save jeremy-brenner/bcb33e2348576fb01e3a7a1328ec8892 to your computer and use it in GitHub Desktop.
gulpfile
var gulp = require('gulp');
var pug = require('gulp-pug');
var stylus = require('gulp-stylus');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var copy = require('gulp-copy');
gulp.task('default', ['compile']);
gulp.task('compile', ['pug','styl','babel','img'] );
gulp.task('watch', ['compile','watchers'] );
gulp.task('watchers', function() {
gulp.watch('src/*.pug', ['pug'] );
gulp.watch('src/styl/*.styl', ['styl'] );
gulp.watch('src/js/**/*.js', ['babel'] );
gulp.watch('src/img/**/*', ['img'] );
});
gulp.task('pug', function(){
gulp.src('src/*.pug')
.pipe(pug())
.pipe(gulp.dest('www/'));
});
gulp.task('styl', function(){
gulp.src('src/styl/*.styl')
.pipe(stylus())
.pipe(gulp.dest('www/css/'));
});
gulp.task('babel',function(){
gulp.src('src/js/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(concat('index.js'))
.pipe(gulp.dest('www/js/'));
});
gulp.task('img',function(){
gulp.src('src/img/**/*')
.pipe(copy('www/img/',{prefix:2}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment