Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhl/9a5dda1a0ba46cb31d49 to your computer and use it in GitHub Desktop.
Save andrewhl/9a5dda1a0ba46cb31d49 to your computer and use it in GitHub Desktop.
var gulp = require('gulp'),
notify = require('gulp-notify'),
phpspec = require('gulp-phpspec'),
browserify = require('gulp-browserify'),
sass = require('gulp-sass'),
compass = require('gulp-compass');
gulp.task('phpspec', function() {
var options = {notify: false};
gulp.src('app/spec/**/*.php')
.pipe(phpspec('', options))
.on('error', notify.onError({
title: "Testing Failed",
message: "Error(s) occurred during test..."
}))
.pipe(notify({
title: "Testing Passed",
message: "All tests have passed..."
}));
});
gulp.task('scripts', function() {
// Single entry point to browserify
gulp.src('app/javascript/main.js')
.pipe(browserify({
insertGlobals : true,
debug : !gulp.env.production
}))
.pipe(gulp.dest('./public/js'))
});
gulp.task('sass', function () {
gulp.src('./app/assets/scss/*.scss')
.pipe(sass())
.pipe(gulp.dest('./public/css'));
});
gulp.task('watch', function() {
gulp.watch('app/spec/**/*.php', ['phpspec'])
gulp.watch('app/javascript/**/*.js', ['scripts'])
gulp.watch('app/assets/scss/**/*.scss', ['sass'])
});
gulp.task('compass', function() {
gulp.src('./app/assets/scss/*.scss')
.pipe(compass({
config_file: './config.rb',
css: './public/css',
sass: './app/assets/scss'
}))
.pipe(gulp.dest('app/assets/temp'));
});
gulp.task('default', ['phpspec', 'scripts', 'sass', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment