Skip to content

Instantly share code, notes, and snippets.

@hunvreus
Created May 5, 2016 03:17
Show Gist options
  • Save hunvreus/5b34b0b3b25e10b564fa0656681acc64 to your computer and use it in GitHub Desktop.
Save hunvreus/5b34b0b3b25e10b564fa0656681acc64 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minify = require('gulp-minify-css');
var assets = {
'js': [
"bower_components/jquery/dist/jquery.js",
"bower_components/highlightjs/highlight.pack.js",
"bower_components/jquery-timeago/jquery.timeago.js",
"_js/*.js"
],
'css': [ "_scss/**/*.{scss,sass}" ]
};
// Prepares the JS file
gulp.task('js', function() {
gulp.src(assets.js)
.pipe(concat('scripts.js'))
.pipe(uglify())
.pipe(gulp.dest('assets'));
});
// Prepares the CSS file
gulp.task('css', function() {
gulp.src(assets.css)
.pipe(sass({ includePaths: require('node-bourbon').includePaths }))
.pipe(concat('styles.css'))
.pipe(minify({keepBreaks:true}))
.pipe(gulp.dest('_includes'));
});
// Prepares JS & CSS assets
gulp.task('default', ['css', 'js']);
// Prepares assets & watch for changes
gulp.task('development', ['css', 'js'], function(callback) {
gulp.watch(assets.js, ['js']);
gulp.watch(assets.css, ['css']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment