sindresorhus / gulp-vulcanize

Concatenate a set of Web Components into one file
MIT License
100 stars 25 forks source link

abspath error #29

Closed gaarf closed 9 years ago

gaarf commented 9 years ago

gulp-vulcanize does not seem to pick up the abspath option. It works fine when using vulcanize directly on command line.

gulp.task('vulcanize', ['html:elements'], function (done) {

  /**
   * gulp-vulcanize does not work as expected!
   */

  // return gulp.src('./dist/assets/elements/x-app/all-imports.html')
  //   .pipe(plug.vulcanize({
  //     abspath: __dirname
  //   }))
  //   .pipe(plug.concat('x-app.vulcanized.html'))
  //   .pipe(gulp.dest('./dist/assets/bundle'));

  /**
   * same thing using command-line does work
   */

  var output = [],
      child = spawn(
        './node_modules/gulp-vulcanize/node_modules/.bin/vulcanize',
        [ '--abspath', '.', 'dist/assets/elements/x-app/all-imports.html' ],
        { cwd: __dirname }
      );

  child.stdout.on('data', function (b) {
    output.push(b);
  });

  child.on('close', function() {
    var filename = __dirname + '/dist/assets/bundle/x-app.vulcanized.html';
    mkdirp(path.dirname(filename), function() {
      fs.writeFile(filename, Buffer.concat(output), done);
    });
  });

});

all-imports.html contains both relative and absolute imports. Eg:

<link rel="import" href="./x-app.html">
<link rel="import" href="/bower_components/paper-styles/paper-styles.html">
<link rel="import" href="../lorem-ipsum/lorem-ipsum.html">
sindresorhus commented 9 years ago

Same answer as https://github.com/sindresorhus/gulp-vulcanize/issues/27#issuecomment-110118652. This plugin just passes everything to vulcanize, open an issue there.

gaarf commented 9 years ago

https://github.com/Polymer/vulcanize/issues/203