Skip to content

Instantly share code, notes, and snippets.

@codegenin
Forked from laracasts/gulpfile.js
Created September 29, 2015 17:03
Show Gist options
  • Save codegenin/e078012d9f0ca69f2dbf to your computer and use it in GitHub Desktop.
Save codegenin/e078012d9f0ca69f2dbf to your computer and use it in GitHub Desktop.

Revisions

  1. laracasts revised this gist Jan 28, 2014. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions gulpfile.js
    Original file line number Diff line number Diff line change
    @@ -40,11 +40,7 @@ gulp.task('js', function () {

    // Run all PHPUnit tests
    gulp.task('phpunit', function() {
    var success = true;

    exec('phpunit', function(error, stdout) {
    if (error) success = false;

    sys.puts(stdout);
    });
    });
  2. laracasts revised this gist Jan 28, 2014. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions gulpfile.js
    Original file line number Diff line number Diff line change
    @@ -25,24 +25,26 @@ var targetJSDir = 'public/js';
    // and save to target CSS directory
    gulp.task('css', function () {
    return gulp.src(sassDir + '/main.sass')
    .pipe(sass({ style: 'compressed' }))
    .pipe(sass({ style: 'compressed' }).on('error', gutil.log))
    .pipe(autoprefix('last 10 version'))
    .pipe(gulp.dest(targetCSSDir))
    .pipe(notify('CSS minified'))
    .on('error', gutil.log);
    });

    // Handle CoffeeScript compilation
    gulp.task('js', function () {
    return gulp.src(coffeeDir + '/**/*.coffee')
    .pipe(coffee())
    .pipe(coffee().on('error', gutil.log))
    .pipe(gulp.dest(targetJSDir))
    .on('error', gutil.log);
    });

    // Run all PHPUnit tests
    gulp.task('phpunit', function() {
    var success = true;

    exec('phpunit', function(error, stdout) {
    if (error) success = false;

    sys.puts(stdout);
    });
    });
  3. laracasts revised this gist Jan 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gulpfile.js
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ gulp.task('phpunit', function() {
    });
    });

    // Keep an eye on Sass and Tests for changes...
    // Keep an eye on Sass, Coffee, and PHP files for changes...
    gulp.task('watch', function () {
    gulp.watch(sassDir + '/**/*.sass', ['css']);
    gulp.watch(coffeeDir + '/**/*.coffee', ['js']);
  4. laracasts revised this gist Jan 28, 2014. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions gulpfile.js
    Original file line number Diff line number Diff line change
    @@ -20,9 +20,6 @@ var coffeeDir = 'app/assets/coffee';
    // Which directory should CoffeeScript compile to?
    var targetJSDir = 'public/js';

    // Where do you put your tests?
    var testsDir = 'app/tests';


    // Compile Sass, autoprefix CSS3,
    // and save to target CSS directory
  5. laracasts created this gist Jan 27, 2014.
    61 changes: 61 additions & 0 deletions gulpfile.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    var gulp = require('gulp');
    var gutil = require('gulp-util');
    var notify = require('gulp-notify');
    var sass = require('gulp-ruby-sass');
    var autoprefix = require('gulp-autoprefixer');
    var minifyCSS = require('gulp-minify-css')
    var coffee = require('gulp-coffee');
    var exec = require('child_process').exec;
    var sys = require('sys');

    // Where do you store your Sass files?
    var sassDir = 'app/assets/sass';

    // Which directory should Sass compile to?
    var targetCSSDir = 'public/css';

    // Where do you store your CoffeeScript files?
    var coffeeDir = 'app/assets/coffee';

    // Which directory should CoffeeScript compile to?
    var targetJSDir = 'public/js';

    // Where do you put your tests?
    var testsDir = 'app/tests';


    // Compile Sass, autoprefix CSS3,
    // and save to target CSS directory
    gulp.task('css', function () {
    return gulp.src(sassDir + '/main.sass')
    .pipe(sass({ style: 'compressed' }))
    .pipe(autoprefix('last 10 version'))
    .pipe(gulp.dest(targetCSSDir))
    .pipe(notify('CSS minified'))
    .on('error', gutil.log);
    });

    // Handle CoffeeScript compilation
    gulp.task('js', function () {
    return gulp.src(coffeeDir + '/**/*.coffee')
    .pipe(coffee())
    .pipe(gulp.dest(targetJSDir))
    .on('error', gutil.log);
    });

    // Run all PHPUnit tests
    gulp.task('phpunit', function() {
    exec('phpunit', function(error, stdout) {
    sys.puts(stdout);
    });
    });

    // Keep an eye on Sass and Tests for changes...
    gulp.task('watch', function () {
    gulp.watch(sassDir + '/**/*.sass', ['css']);
    gulp.watch(coffeeDir + '/**/*.coffee', ['js']);
    gulp.watch('app/**/*.php', ['phpunit']);
    });

    // What tasks does running gulp trigger?
    gulp.task('default', ['css', 'js', 'phpunit', 'watch']);