Skip to content

Instantly share code, notes, and snippets.

@mrkaspa
Created June 28, 2015 04:11
Show Gist options
  • Save mrkaspa/ce3b38658e674fdb3d00 to your computer and use it in GitHub Desktop.
Save mrkaspa/ce3b38658e674fdb3d00 to your computer and use it in GitHub Desktop.
Setting Gulp for Sass, Coffee y Browserify
var gulp = require('gulp');
var gutil = require('gulp-util');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var coffee = require('gulp-coffee');
var browserify = require('gulp-browserify')
var paths = {
sass: ['./public/scss/**/*.scss', './public/sass/**/*.sass'],
coffee: ['./public/coffee/**/*.coffee']
};
gulp.task('default', ['watch']);
gulp.task('coffee', function() {
gulp.src('./public/coffee/*.coffee')
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./public/js/'))
});
gulp.task('browserify', function() {
gulp.src('./public/coffee/app.coffee').pipe(browserify({
transform: ['coffeeify'],
extensions: ['.coffee']
})).pipe(rename('app.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('sass', function(done) {
gulp.src('./public/sass/app.sass')
.pipe(sass({
errLogToConsole: true
}))
.pipe(gulp.dest('./public/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./public/css/'))
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.coffee, ['browserify']);
});
{
"name": "SocialDonor",
"version": "1.0.0",
"dependencies": {
"coffeeify": "^1.1.0",
"gulp": "^3.5.6",
"gulp-browserify": "^0.5.1",
"gulp-coffee": "^2.3.1",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^1.3.3",
"gulp-util": "^2.2.14"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment