Skip to content

Instantly share code, notes, and snippets.

@tdomarkas
Last active August 29, 2015 14:13
Show Gist options
  • Save tdomarkas/48dc550239dc2eab79be to your computer and use it in GitHub Desktop.
Save tdomarkas/48dc550239dc2eab79be to your computer and use it in GitHub Desktop.
Gulpfile boilerplate
var gulp = require('gulp'),
concat = require('gulp-concat'),
less = require('gulp-less'),
uglify = require('gulp-uglify');
var files = {
copyCss: [
'bower_components/animate.css/animate.min.css',
'bower_components/suit-components-arrange/lib/arrange.css'
],
copyScripts: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/underscore/underscore-min.js',
'bower_components/backbone/backbone.js'
],
less: [
'src/less/app.less'
],
scripts: [
'bower_components/bootstrap/js/transition.js',
'bower_components/bootstrap/js/alert.js',
'bower_components/bootstrap/js/button.js',
'bower_components/bootstrap/js/carousel.js',
'bower_components/bootstrap/js/collapse.js',
'bower_components/bootstrap/js/dropdown.js',
'bower_components/bootstrap/js/modal.js',
'bower_components/bootstrap/js/tooltip.js',
'bower_components/bootstrap/js/popover.js',
'bower_components/bootstrap/js/scrollspy.js',
'bower_components/bootstrap/js/tab.js',
'bower_components/bootstrap/js/affix.js',
'src/js/*.js'
]
};
gulp.task('copy-css', function() {
return gulp.src(files.copyCss)
.pipe(gulp.dest('web/css'));
});
gulp.task('less', function() {
return gulp.src(files.less)
.pipe(less())
.pipe(concat('app.css'))
.pipe(gulp.dest('web/css'));
});
gulp.task('copy-scripts', function() {
return gulp.src(files.copyScripts)
.pipe(gulp.dest('web/js'));
});
gulp.task('scripts', function() {
return gulp.src(files.scripts)
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gulp.dest('web/js'));
});
gulp.task('watch', function() {
gulp.watch('src/less/**/*.less', ['less']);
gulp.watch('src/js/**/*.js', ['scripts']);
});
gulp.task('default', ['copy-css', 'copy-scripts', 'scripts', 'less', 'watch'], function() {
// do stuff...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment