gulp is sometimes slow to start
See original GitHub issueOn my machine with lots of softwares (sketch, firefox as frontend dev, VMs, etc), I don’t have enough ram for gulp and its start is in this case really slow.
Once it was started, all is ok, the compilation is really fast and the next time I start gulp, it’ll be fast too.
Note : This issue is for the moment a memo, I’ll be back with more information. 😉
An indication of a compilation without troubles:
Thu 21 Aug 2014 12:08:33 CEST
[12:08:34] Using gulpfile ~/xxx/xxx/xxx/gulpfile.js
[12:08:34] Starting 'clean:dist'...
[12:08:34] Finished 'clean:dist' after 16 ms
[12:08:34] Starting 'clean:build'...
[12:08:34] Finished 'clean:build' after 252 μs
[12:08:34] Starting 'assets'...
[12:08:34] Starting 'images'...
[12:08:34] Starting 'svg'...
[12:08:34] Starting 'templates'...
[12:08:34] Finished 'assets' after 170 ms
[12:08:34] Finished 'templates' after 177 ms
[12:08:34] Starting 'scripts'...
[12:08:34] Finished 'svg' after 384 ms
[12:08:34] Starting 'styles:all'...
[12:08:38] Finished 'styles:all' after 3.92 s
[12:08:38] Finished 'scripts' after 4.15 s
[12:08:38] Finished 'images' after 4.43 s
[12:08:38] Starting 'compile'...
[12:08:38] Finished 'compile' after 9.18 μs
Thu 21 Aug 2014 12:08:38 CEST
Packages:
{
"gulp": "3.8.6",
"gulp-concat": "2.2.0",
"gulp-consolidate": "0.1.2",
"gulp-declare": "0.2.0",
"gulp-define-module": "0.1.1",
"gulp-filter": "0.5.0",
"gulp-handlebars": "2.1.0",
"gulp-iconfont": "0.1.0",
"gulp-imagemin": "0.6.1",
"gulp-jshint": "1.6.3",
"gulp-livereload": "2.1.0",
"gulp-minify-css": "0.3.5",
"gulp-myth": "0.3.1",
"gulp-plumber": "0.6.3",
"gulp-rename": "1.2.0",
"gulp-replace": "0.3.0",
"gulp-rev": "0.4.2",
"gulp-svg-symbols": "0.1.2",
"gulp-svgmin": "0.4.6",
"gulp-uglify": "0.3.1",
"gulp-util": "2.2.17"
}
gulpfile.js:
/**
* Imports
*/
var gulp = require('gulp')
var livereload = require('gulp-livereload')
/**
* Helpers
*/
var path = __dirname + '/gulp/'
/**
* Private tasks
*/
gulp.task('clean:dist', require(path + 'clean').dist)
gulp.task('clean:build', require(path + 'clean').build)
gulp.task('assets', require(path + 'assets'))
gulp.task('images', require(path + 'images'))
gulp.task('glyphicons', require(path + 'glyphicons'))
gulp.task('svg', require(path + 'svg'))
gulp.task('styles', require(path + 'styles'))
gulp.task('styles:all', ['svg'], require(path + 'styles'))
gulp.task('jshint', require(path + 'jshint'))
gulp.task('scripts', ['templates'], require(path + 'scripts'))
gulp.task('templates', require(path + 'templates'))
/**
* Public tasks
*/
gulp.task('compile', ['clean:dist', 'clean:build', 'assets', 'images', 'styles:all', 'scripts'])
gulp.task('watch', ['compile'], function() {
livereload.listen()
gulp.watch('src/frontend/assets/**/*}', ['assets'])
gulp.watch('src/frontend/images/**/*}', ['images'])
gulp.watch('src/frontend/**/{*.js, *.hbs}', ['scripts'])
gulp.watch('src/frontend/styles/**/*.css', ['styles'])
gulp.watch(['web/assets/**/*', 'resources/views/**/*.tpl']).on('change', livereload.changed)
})
node : v0.10.31
macosx : 10.9.4
An example of task:
var gulp = require('gulp')
var es = require('event-stream')
var gutil = require('gulp-util')
var imagemin = require('gulp-imagemin')
var svgmin = require('gulp-svgmin')
module.exports = function() {
var bitmap = gulp.src('src/frontend/images/**/{*.png,*.gif,*.jpg,*.jpeg}')
.pipe( gutil.env.dist ? imagemin( { optimizationLevel: 5 } ) : gutil.noop() )
var vector = gulp.src('src/frontend/images/**/*.svg')
.pipe( gutil.env.dist ? svgmin() : gutil.noop() )
return es.merge( bitmap, vector).pipe( gulp.dest('web/assets/images') )
}
Issue Analytics
- State:
- Created 9 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Very slow BrowserSync server startup with Gulp - Stack Overflow
BrowserSync itself seems to initialize right away when I run Gulp, but it takes about 4 to 5 minutes (and occasionally more) for...
Read more >Gulp compile is this normal speed or unusually slow?
I just starting with Gulp but when i run it it takes a while. I dont know if it is because 2048 memory...
Read more >gulp-ll-next | Yarn - Package Manager
Run CPU-consuming Gulp tasks in the separate processes to achieve faster builds. gulp, multiprocess, process, thread. readme. gulp-ll. < ...
Read more >Working Fast & Proper with Gulp | UpTrending - HUSL Digital
I recently evaluated our development asset pipeline and noticed that we might be able to reduce our compile times. We've always been a...
Read more >Concatenate & Minify Javascript with Gulp, Improve Site ...
Numerous requests for large files can slow site performance. With Gulp, we can improve the overall performance of our sites and applications ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kud you can use time-require to figure out which require is the slowest. But the require mechanism is expensive, especially on non-SSD harddrives.
I think I’ve found the problem.
As loading gulp modules ask lots of require, it does some I/O, and as I’m swapping at the same time, the hard disk hurts a lot. 😃