Skip to content

Instantly share code, notes, and snippets.

@jbennett
Created May 5, 2014 15:09
Show Gist options
  • Save jbennett/caa07fb226a5eca6f3bc to your computer and use it in GitHub Desktop.
Save jbennett/caa07fb226a5eca6f3bc to your computer and use it in GitHub Desktop.
Base Gulp
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
filter = require('gulp-filter'),
gulpif = require('gulp-if'),
minify = require('gulp-minify-css'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-sass')
uglify = require('gulp-uglify');
var paths = {
sass: ['scss/**/*.scss'],
scripts: [
'scripts/lib/**/*.js',
'scripts/src/**/!(main)*.js',
'scripts/src/main.js' // order matters, use main.js to boot the system
]
};
gulp.task('styles', function() {
return gulp.src(paths.sass)
.pipe(plumber())
.pipe(sass({errLogToConsole: true}))
.pipe(autoprefixer())
.pipe(gulp.dest('css'))
.pipe(rename('styles.min.css'))
.pipe(minify())
.pipe(gulp.dest('css'));
});
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(concat('scripts.js'))
.pipe(gulp.dest('scripts'))
.pipe(uglify())
.pipe(rename('scripts.min.js'))
.pipe(gulp.dest('scripts'));
});
gulp.task('watch', function() {
gulp.watch(paths.sass, function() {
gulp.start('styles');
});
gulp.watch(paths.scripts, function() {
gulp.start('scripts');
});
});
gulp.task('build', function() {
gulp.start('styles');
gulp.start('scripts');
});
{
"devDependencies": {
"gulp": "~3.5.6",
"gulp-sass": "~0.7.1",
"gulp-autoprefixer": "0.0.6",
"gulp-filter": "~0.3.1",
"gulp-minify-css": "~0.3.0",
"gulp-plumber": "~0.5.6",
"gulp-concat": "~2.2.0",
"gulp-rename": "~1.2.0",
"gulp-uglify": "~0.2.1",
"gulp-if": "0.0.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment