diff --git a/gulp/build.coffee b/gulp/build.coffee deleted file mode 100644 index 0fbd95a7..00000000 --- a/gulp/build.coffee +++ /dev/null @@ -1,3 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'build', ['clean', 'styles', 'scripts', 'fonts', 'images'] diff --git a/gulp/clean.coffee b/gulp/clean.coffee deleted file mode 100644 index 0f64f785..00000000 --- a/gulp/clean.coffee +++ /dev/null @@ -1,6 +0,0 @@ -gulp = require 'gulp' -del = require 'del' - -gulp.task 'clean', -> - del.sync 'output_*/assets/{css,fonts,images,js}' - del.sync gulp.config.outputDir + '/{css,fonts,images,js}' diff --git a/gulp/default.coffee b/gulp/default.coffee deleted file mode 100644 index 9f9f94f7..00000000 --- a/gulp/default.coffee +++ /dev/null @@ -1,3 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'default', ['build', 'watch'] diff --git a/gulp/fonts.coffee b/gulp/fonts.coffee deleted file mode 100644 index af78b31d..00000000 --- a/gulp/fonts.coffee +++ /dev/null @@ -1,5 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'fonts', -> - gulp.src gulp.config.bowerDir + '/font-awesome/fonts/*' - .pipe gulp.dest gulp.config.outputDir + '/fonts' diff --git a/gulp/images.coffee b/gulp/images.coffee deleted file mode 100644 index 302b1479..00000000 --- a/gulp/images.coffee +++ /dev/null @@ -1,11 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'images', -> gulp.start 'copy-images', 'meetup-thumbnails' - -gulp.task 'meetup-thumbnails', -> - gulp.src gulp.config.assetsDir + '/images/meetups/originals/*' - .pipe gulp.plugins.imageResize height: '80' - .pipe gulp.dest gulp.config.outputDir + '/images/meetups/thumbnails' - -gulp.task 'copy-images', -> - gulp.copy gulp.config.assetsDir + '/images/**/*', gulp.config.outputDir + '/images' diff --git a/gulp/minify-images.coffee b/gulp/minify-images.coffee deleted file mode 100644 index bc66e949..00000000 --- a/gulp/minify-images.coffee +++ /dev/null @@ -1,6 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'minify-images', -> - gulp.src gulp.config.assetsDir + '/images/**/*' - .pipe gulp.plugins.imagemin() - .pipe gulp.dest gulp.config.assetsDir + '/images' diff --git a/gulp/minify-prod-html.coffee b/gulp/minify-prod-html.coffee deleted file mode 100644 index 9d0f76eb..00000000 --- a/gulp/minify-prod-html.coffee +++ /dev/null @@ -1,6 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'minify-prod-html', -> - gulp.src 'output_prod/**/*.html' - .pipe gulp.plugins.htmlmin 'collapseWhitespace': true - .pipe gulp.dest 'output_prod' diff --git a/gulp/scripts.coffee b/gulp/scripts.coffee deleted file mode 100644 index 231d2f2f..00000000 --- a/gulp/scripts.coffee +++ /dev/null @@ -1,8 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'scripts', -> - gulp.js [ - gulp.config.bowerDir + '/jquery/dist/jquery.js', - gulp.config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', - gulp.config.assetsDir + '/' + gulp.config.jsPattern - ], 'site.js' diff --git a/gulp/styles.coffee b/gulp/styles.coffee deleted file mode 100644 index ca19df69..00000000 --- a/gulp/styles.coffee +++ /dev/null @@ -1,7 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'styles', -> - gulp.css [ - gulp.config.bowerDir + '/font-awesome/css/font-awesome.css', - gulp.config.assetsDir + '/sass/site.sass' - ], 'site.css' diff --git a/gulp/watch.coffee b/gulp/watch.coffee deleted file mode 100644 index a9a11a21..00000000 --- a/gulp/watch.coffee +++ /dev/null @@ -1,8 +0,0 @@ -gulp = require 'gulp' - -gulp.task 'watch', -> - gulp.plugins.refresh.listen() - - gulp.watch gulp.config.sassPattern, ['styles'] - gulp.watch gulp.config.assetsDir + gulp.config.jsPattern, ['scripts'] - gulp.watch gulp.config.assetsDir + '/images/**/*', ['copy-images'] diff --git a/gulpfile.coffee b/gulpfile.coffee deleted file mode 100644 index 81ed6701..00000000 --- a/gulpfile.coffee +++ /dev/null @@ -1,39 +0,0 @@ -gulp = require 'gulp' -gulp.plugins = require('gulp-load-plugins')() - -gulp.config = - assetsDir: './assets', - bowerDir: './vendor/bower', - outputDir: './source/assets', - sassPattern: './assets/sass/**/*.sass', - jsPattern: 'js/**/*.js', - production: gulp.plugins.util.env.production || false - -gulp.css = (paths, filename) -> - gulp.src paths - .pipe gulp.plugins.plumber() - .pipe gulp.plugins.if !gulp.config.production, gulp.plugins.sourcemaps.init() - .pipe gulp.plugins.sassGlob() - .pipe gulp.plugins.sass() - .pipe gulp.plugins.autoprefixer browsers: ['last 2 versions'] - .pipe gulp.plugins.concat filename - .pipe gulp.plugins.if gulp.config.production, gulp.plugins.cleanCss() - .pipe gulp.plugins.if !gulp.config.production, gulp.plugins.sourcemaps.write '.' - .pipe gulp.plugins.if !gulp.config.production, gulp.dest 'output_dev/assets/css' - .pipe gulp.plugins.if !gulp.config.production, gulp.plugins.refresh() - .pipe gulp.dest gulp.config.outputDir + '/css' - -gulp.js = (paths, filename) -> - gulp.src paths - .pipe gulp.plugins.plumber() - .pipe gulp.plugins.if gulp.config.sourceMaps, gulp.plugins.sourcemaps.init() - .pipe gulp.plugins.concat filename - .pipe gulp.plugins.if gulp.config.production, gulp.plugins.uglify() - .pipe gulp.plugins.if !gulp.config.production, gulp.plugins.sourcemaps.write '.' - .pipe gulp.dest gulp.config.outputDir + '/js' - -gulp.copy = (srcFiles, outputDir) -> - gulp.src srcFiles - .pipe gulp.dest outputDir - -require("fs").readdirSync("./gulp").forEach (task) -> require "./gulp/#{task}" diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..8d729224 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,103 @@ +'use strict'; + +var gulp = require('gulp'), + plugins = require('gulp-load-plugins')(), + del = require('del'); + +var config = { + assetsDir: 'assets', + bowerDir: 'vendor/bower', + outputDir: 'source/assets', + production: plugins.util.env.production || false +}; + +var app = {}; + +app.css = function (paths, filename) { + gulp.src(paths) + .pipe(plugins.plumber()) + .pipe(plugins.if(!config.production, plugins.sourcemaps.init())) + .pipe(plugins.sassGlob()) + .pipe(plugins.sass()) + .pipe(plugins.autoprefixer({ browsers: 'last 2 versions' })) + .pipe(plugins.concat(filename)) + .pipe(plugins.if(config.production, plugins.cleanCss())) + .pipe(plugins.if(!config.production, plugins.sourcemaps.write('.'))) + .pipe(plugins.if(!config.production, gulp.dest(config.outputDir + '/css'))) + .pipe(plugins.if(!config.production, plugins.refresh())) + .pipe(gulp.dest(config.outputDir + '/css')); +}; + +app.js = function (paths, filename) { + gulp.src(paths) + .pipe(plugins.plumber()) + .pipe(plugins.if(!config.production, plugins.sourcemaps.init())) + .pipe(plugins.concat(filename)) + .pipe(plugins.if(config.production, plugins.uglify())) + .pipe(plugins.if(!config.production, plugins.sourcemaps.write('.'))) + .pipe(gulp.dest(config.outputDir + '/js')); +}; + +app.copy = function (source, destination) { + gulp.src(source) + .pipe(gulp.dest(destination)); +}; + +gulp.task('styles', function () { + app.css([ + config.bowerDir + '/font-awesome/css/font-awesome.css', + config.assetsDir + '/sass/site.sass' + ], 'site.css'); +}); + +gulp.task('scripts', function () { + app.js([ + config.bowerDir + '/jquery/dist/jquery.js', + config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', + config.assetsDir + '/' + config.jsPattern + ], 'site.js'); +}); + +gulp.task('fonts', function () { + app.copy( + config.bowerDir + '/font-awesome/fonts/*', + config.outputDir + '/fonts' + ); +}); + +gulp.task('meetup-thumbnails', function () { + gulp.src(config.assetsDir + '/images/meetups/originals/*') + .pipe(plugins.imageResize({ height: 80 })) + .pipe(gulp.dest(config.assetsDir + '/images/meetups/thumbnails')); +}); + +gulp.task('copy-images', function () { + app.copy(config.assetsDir + '/images/**/*', config.outputDir + '/images'); +}); + +gulp.task('images', ['meetup-thumbnails', 'copy-images']); + +gulp.task('clean', function () { + del.sync(config.outputDir + '/css'); + del.sync(config.outputDir + '/js'); + del.sync('output_*/assets/css'); + del.sync('output_*/assets/js'); +}); + +gulp.task('build', ['clean', 'styles', 'scripts', 'fonts', 'images']); + +gulp.task('watch', function () { + plugins.refresh.listen(); + + gulp.watch('assets/sass/**/*.sass', ['styles']); + gulp.watch('assets/js/**/*.js', ['scripts']); + gulp.watch('assets/images/**/*', ['copy-images']); +}); + +gulp.task('default', ['build', 'watch']); + +gulp.task('minify-prod-html', function () { + gulp.src('output_prod/**/*.html') + .pipe(plugins.htmlmin({ collapseWhitespace: true })) + .pipe(gulp.dest('output_prod')); +});