吞咽和巴贝尔非常慢

时间:2016-04-27 19:50:13

标签: gulp zurb-foundation command-line-interface babeljs gulp-babel

我有吞咽的问题,而且在更大程度上,巴贝尔,跑得非常慢。它需要2-4分钟来处理3个javascript文件。即使我刚刚运行gulp,它似乎至少需要10秒才能启动,不知道为什么。

以下是我的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/'));
});

这是我的package.json文件......



{
  "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"
  }
}
&#13;
&#13;
&#13;

运行gulp scripts后需要4分钟!...

[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

任何想法为什么这么慢?我对npm和gulp相当新,所以我不确定该怎么做。我在家用电脑上安装了另一个基金会项目,它几乎可以立即编译js。所以我肯定在这台机器上搞砸了。

0 个答案:

没有答案