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

View File

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

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", "css/all.css": "css/all-c5b65085.css",
"js/all.js": "js/all-e1f470b3.js" "js/all.js": "js/all-ae88f714.js"
} }