Is it slow from homestead or on your host machine? I've stopped running gulp in homestead for this reason.
Oct 30, 2015
16
Level 55
Gulp takes ages (I think I know why)
Just wanted to see if my gulp file can be tidied up somewhat. What are the best practices and is there a way to show the total time taken to run gulp?
var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.sass('app.scss', 'resources/assets/css/app.scss.output')
.styles([
'app.scss.output',
'../../../node_modules/fuelux/dist/css/fuelux.css',
'../../../node_modules/bootstrap-markdown/css/bootstrap-markdown.min.css',
'../../../node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
'bootstrap-select.css',
'bootstrap-colorselector.css',
'dropzone.css',
'../../../node_modules/sweetalert/dist/sweetalert.css',
], 'public/css/all.css')
.scripts([
'../../../node_modules/jquery/dist/jquery.js',
'../../../node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'../../../node_modules/vue/dist/vue.js',
'../../../node_modules/vue-resource/dist/vue-resource.js',
'bootstrap-select.js',
'../../../node_modules/vue-strap/dist/vue-strap.js',
'salvattore.js',
'../../../node_modules/fuelux/dist/js/fuelux.js',
'../../../node_modules/moment/min/moment.min.js',
'../../../node_modules/bootstrap-markdown/js/bootstrap-markdown.js',
'../../../node_modules/marked/lib/marked.js',
'../../../node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
'bootstrap-colorselector.js',
'../../../node_modules/sweetalert/dist/sweetalert.min.js',
'jeffreyway-delete.js',
'../../../node_modules/dropzone/dist/dropzone.js',
'../../../node_modules/pdfjs-dist/build/pdf.combined.js',
'bootstrap-notify.js',
'../../../node_modules/socket.io-client/socket.io.js',
], 'public/js/app.js')
.copy('node_modules/font-awesome/fonts', 'public/build/fonts')
.copy('node_modules/font-awesome/fonts', 'public/fonts')
.copy('node_modules/bootstrap-sass/assets/fonts/bootstrap', 'public/build/fonts')
.copy('node_modules/bootstrap-sass/assets/fonts/bootstrap', 'public/fonts/bootstrap')
.copy('node_modules/fuelux/dist/fonts', 'public/build/fonts')
.version(['css/all.css', 'js/app.js']);
});
Level 1
I haven't tested it, but probably something like this:
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var uglify_css = require('gulp-minify-css');
elixir(function(mix) {
mix.sass('app.scss', 'resources/assets/css/app.scss.output')
.styles([
'app.scss.output',
'bootstrap-select.css',
'bootstrap-colorselector.css',
'dropzone.css',
], 'public/css/all.css')
.scripts([
'bootstrap-select.js',
'salvattore.js',
'bootstrap-colorselector.js',
'jeffreyway-delete.js',
'bootstrap-notify.js',
], 'public/js/app.js')
.version(['css/all.css', 'js/app.js']);
});
gulp.task('vendor', function() {
// The scripts
gulp.src([
'../../../node_modules/jquery/dist/jquery.js',
'../../../node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'../../../node_modules/vue/dist/vue.js',
'../../../node_modules/vue-resource/dist/vue-resource.js',
'../../../node_modules/vue-strap/dist/vue-strap.js',
'../../../node_modules/fuelux/dist/js/fuelux.js',
'../../../node_modules/moment/min/moment.min.js',
'../../../node_modules/bootstrap-markdown/js/bootstrap-markdown.js',
'../../../node_modules/marked/lib/marked.js',
'../../../node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js',
'../../../node_modules/sweetalert/dist/sweetalert.min.js',
'../../../node_modules/dropzone/dist/dropzone.js',
'../../../node_modules/pdfjs-dist/build/pdf.combined.js',
'../../../node_modules/socket.io-client/socket.io.js',
])
.pipe(concat('vendor.js'))
.pipe(uglify())
.pipe(gulp.dest('./public/js'));
// The styles
gulp.src([
'../../../node_modules/fuelux/dist/css/fuelux.css',
'../../../node_modules/bootstrap-markdown/css/bootstrap-markdown.min.css',
'../../../node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
'../../../node_modules/sweetalert/dist/sweetalert.css',
])
.pipe(concat('vendor.css'))
.pipe(uglify_css())
.pipe(gulp.dest('./public/css'))
// The fonts
gulp.src([
'node_modules/font-awesome/fonts',
'node_modules/bootstrap-sass/assets/fonts/bootstrap',
'node_modules/fuelux/dist/fonts',
])
.pipe(gulp.dest('./public/fonts/'));
})
Dont forget to install the following packages with npm: gulp gulp-concat gulp-uglify gulp-minify-css
Hope this helps!
Please or to participate in this conversation.