简体   繁体   中英

How to properly use gulp-vulcanize

I can't use gulp-vulcanize in my side project. I've followed the example but nothing seems to happen, there are also no errors in the console.

Here is my folder structure:

build/
- html/
- css/
- js/
source/
- html/
- css/
- js/
bower.json
gulpfile.coffee
gulpfile.js
package.json

Here is the gulp task I'm using

gulp.task 'vulcanize',
  ->
    gulp.src 'index.html'
      .pipe plumber()
      .pipe vulcanize {
        abspath: ''
        excludes: []
        stripExcludes: false
      }
      .pipe gulp.dest 'vulcanized'

I'm using the following for vulcanizing my html files:

  • gulp - 3.9.0
  • gulp-vulcanize - 6.1.0
  • gul-crisper - 1.0.0

There is no index.html file in the same directory as your gulpfile . So nothing can happen. Give it the proper path :

gulp.task 'vulcanize', ->
    gulp.src 'build/html/index.html'
        .pipe vulcanize()
        .pipe gulp.dest 'vulcanized'

Don't pass any option to vulcanuze(), as you're just passing its defaults, so it's useless.

BTW, Gulp accepts coffee files, you don't have to compile your gulpfile.coffee into gulpfile.js . Just go :

npm install -g coffee-script

gulp

> using gulpfile.coffee

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM