ecmascript 6 - Yeoman fail with gulp in babel (es2015) -
i created yeoman generator , when start using babel e.g. change gulpefile.js
gulpfile.babel.js
(and add .babelrc
file) outside gulpfile.js
(not project gulpfile.babel.js
) start fail.
the project generated gulpfile.babel.js
works. , manage pin point failed gulp task gulp pre-test
.
this yeoman generator tree:
. ├── readme.md ├── generators │ └── app │ ├── index.js │ └── templates │ └── my-awesome-site │ ├── gemfile │ ├── readme.md │ ├── _config.yml │ ├── _includes │ │ ├── footer.html │ │ ├── head.html │ │ └── header.html │ ├── _layouts │ │ ├── default.html │ │ ├── page.html │ │ └── post.html │ ├── _posts │ │ └── 2016-09-08-welcome-to-jekyll.markdown │ ├── about.md │ ├── feed.xml │ ├── gulpfile.babel.js │ ├── images │ │ └── touch │ │ ├── apple-touch-icon.png │ │ ├── chrome-touch-icon-192x192.png │ │ ├── icon-128x128.png │ │ └── ms-touch-icon-144x144-precomposed.png │ ├── index.html │ ├── package.json │ ├── robots.txt │ ├── scss │ │ ├── _base.scss │ │ ├── _layout.scss │ │ ├── _syntax-highlighting.scss │ │ └── main.scss │ └── travis ├── gulpfile.js ├── package.json └── test └── app.js
i managed pinpoint failed gulp task gulp pre-test
:
gulp.task('pre-test', function () { return gulp.src('generators/**/*.js') .pipe(excludegitignore()) .pipe(istanbul({ includeuntested: true })) .pipe(istanbul.hookrequire()); });
the error message:
[10:26:27] using gulpfile ~/webstormprojects/generator-jekyll-starter-kit/gulpfile.js [10:26:27] starting 'pre-test'... failed parse file: /users/nirgalon/webstormprojects/generator-jekyll-starter-kit/generators/app/templates/my-awesome-site/gulpfile.babel.js events.js:160 throw er; // unhandled 'error' event ^ error: unable parse /users/nirgalon/webstormprojects/generator-jekyll-starter-kit/generators/app/templates/my-awesome-site/gulpfile.babel.js line 3: unexpected token
the gulpfile.babel.js
around line 3:
'use strict'; import gulp 'gulp'; import gulploadplugins 'gulp-load-plugins'; import runsequence 'run-sequence'; import browsersync 'browser-sync'; const $ = gulploadplugins(); // minify html. gulp.task('minify-html', () => { return gulp.src('_site/**/*.html') .pipe($.htmlmin({ removecomments: true, collapsewhitespace: true, collapsebooleanattributes: true, removeattributequotes: true, removeredundantattributes: true, removeemptyattributes: true, removescripttypeattributes: true, removestylelinktypeattributes: true, removeoptionaltags: true })) .pipe(gulp.dest('_site')) });
i try figure out, no success (i thought has babel, , tried install babel in project root package.json
).
you're using es2015 in gulpfile. chance node version doesn't support it?
Comments
Post a Comment