I'm having issues with gulp and to a greater extent, babel, running extremely slow. It literally takes 2-4 minutes to process 3 javascript files. Even when I just run gulp
it seems to take at least 10 seconds to start up, not sure why.
Here are the relevent parts of my gulpfile.js...
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var jshint = require('gulp-jshint');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var babel = require("gulp-babel");
var browserSync = require('browser-sync').create();
var uglify = require('gulp-uglify');
gulp.task('scripts', function() {
return gulp.src([
'bower_components/foundation-sites/js/foundation.core.js',
'bower_components/foundation-sites/js/foundation.util.mediaQuery.js',
'js/owl.carousel.min.js'])
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['es2015']
}))
.pipe(concat('plugins.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./js/'));
});
And this is my package.json file...
{
"name": "foundation-sites-template",
"version": "1.0.0",
"description": "Basic template for a new Foundation for Sites project.",
"main": "gulpfile.js",
"devDependencies": {
"babel-plugin-transform-es2015-arrow-functions": "^6.7.7",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.6.5",
"babel-plugin-transform-es2015-block-scoping": "^6.7.1",
"babel-plugin-transform-es2015-classes": "^6.7.7",
"babel-plugin-transform-es2015-destructuring": "^6.6.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.7.7",
"babel-plugin-transform-es2015-parameters": "^6.7.0",
"babel-plugin-transform-es2015-shorthand-properties": "^6.5.0",
"babel-plugin-transform-es2015-spread": "^6.6.5",
"babel-plugin-transform-es2015-template-literals": "^6.6.5",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.7.2",
"browser-sync": "^2.12.5",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-babel": "^6.1.2",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.0",
"gulp-load-plugins": "^1.1.0",
"gulp-sass": "^2.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"gulp-uglify": "^1.5.3",
"jshint": "^2.9.2"
},
"scripts": {
"start": "gulp",
"build": "gulp sass"
},
"repository": {
"type": "git",
"url": "https://github.com/zurb/foundation-sites-template.git"
},
"bugs": {
"url": "https://github.com/zurb/foundation-sites/issues",
"email": "foundation@zurb.com"
},
"author": "ZURB <foundation@zurb.com>",
"license": "MIT",
"private": true,
"dependencies": {
"gulp-autoprefixer": "^3.1.0"
}
}
After running gulp scripts
it take 4 minutes!...
[15:41:47] Using gulpfile /Applications/MAMP/htdocs/example/wp-content/themes/example/gulpfile.js
[15:41:47] Starting 'scripts'...
[15:43:55] Finished 'scripts' after 4.13 min
Any ideas why this is so slow? I'm fairly new to npm and gulp so I'm not really sure what to do. I have another Foundation project set up on my home computer and it compiles js almost instantly. So I definitely have something screwed up on this machine.