Finally fixed the Gulp build process

This commit is contained in:
James Brooks 2015-01-02 14:29:07 +00:00
parent 92d16aa7f8
commit 152dda8b46
5 changed files with 18447 additions and 71 deletions

View File

@ -1,64 +1,39 @@
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var changed = require('gulp-changed');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var jshint = require('laravel-elixir-jshint');
var rimraf = require('gulp-rimraf');
/**
* Custom Elixir job for copying images, but only if they're newer.
*/
elixir.extend('images', function() {
gulp.task('copy-images', function() {
gulp.src('app/assets/bower_components/jquery/dist/jquery.min.map')
.pipe(changed('public/build/js/jquery.min.map', {
hasChanged: changed.compareSha1Digest
}))
.pipe(gulp.dest('public/build/js'));
gulp.src('app/assets/bower_components/ionicons/fonts/**')
.pipe(changed('public/build/fonts/ionicons', {
hasChanged: changed.compareSha1Digest
}))
.pipe(gulp.dest('public/build/fonts'));
elixir.extend('rm', function(source) {
gulp.task('rm', function() {
gulp.src(source, { read: false })
.pipe(rimraf());
});
return this.queueTask('copy-images');
});
/**
* Run JSHint on our JavaScript sources.
*/
elixir.extend('jshint', function() {
gulp.task('jshint', function() {
gulp.src('app/assets/js/**')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'));
});
return this.queueTask('jshint');
return this.queueTask('rm');
});
gulp.task('default', function() {
elixir(function (mix) {
mix.sass('app/assets/sass/main.scss')
.rm('public/build/fonts')
.jshint('app/assets/js/*.js')
.styles([
'app/assets/bower_components/ionicons/css/ionicons.min.css',
'app/assets/bower_components/jquery-minicolors/jquery.minicolors.css',
'public/css/main.css',
], './')
.scripts([
'bower_components/jquery/dist/jquery.min.js',
'bower_components/jquery/dist/jquery.js',
'bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js',
'bower_components/lodash/dist/lodash.js',
'bower_components/messenger/build/js/messenger.js',
// 'bower_components/chartjs/Chart.min.js',
'bower_components/Sortable/Sortable.js',
'bower_components/jquery-minicolors/jquery.minicolors.js',
'bower_components/jquery-serialize-object/jquery.serialize-object.js',
'js/app.js',
'js/**/*.js',
], './app/assets/')
.jshint()
.images()
.version(['public/css/all.css', 'public/js/all.js']);
.version(['public/css/all.css', 'public/js/all.js'])
.copy('app/assets/bower_components/ionicons/fonts', 'public/build/fonts');
});
});

View File

@ -1,9 +1,8 @@
{
"devDependencies": {
"gulp": "^3.8.8",
"gulp-changed": "1.1.0",
"gulp-jshint": "1.9.0",
"jshint-stylish": "1.0.0",
"laravel-elixir": "*"
"gulp-rimraf": "0.1.1",
"laravel-elixir": "*",
"laravel-elixir-jshint": "0.1.6"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"css/all.css": "css/all-c5b65085.css",
"js/all.js": "js/all-e1f470b3.js"
"js/all.js": "js/all-ae88f714.js"
}