tools: gulp-vulcanize doesnt seem to make use of abspath option

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">

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I still cannot get this to work with gulp-vulcanize properly - polymer is included twice. Output during build:

Ignoring duplicate element definition: custom-style
Ignoring duplicate element definition: dom-template
Ignoring duplicate element definition: dom-repeat
Ignoring duplicate element definition: array-selector
Ignoring duplicate element definition: dom-if
Ignoring duplicate element definition: dom-bind

And in browser when loading vulcanized elements:

Failed to execute 'registerElement' on 'Document': Registration failed for type 'dom-module'. A type with that name is already registered.

If I try the abspath & inputUrl config like:

gulp.task('vulcanize', function () {
    var DEST_DIR = 'dist/elements';

    return gulp.src('dist/elements/elements.vulcanized.html')
      .pipe($.vulcanize({
        abspath: path.resolve('dist'),
        inputUrl: '/elements/elements.vulcanized.html',
        excludes: [
        ],
        stripExcludes: false,
        inlineScripts: false,
        inlineCss: false,
        implicitStrip: true,
        stripComments: true
      })) 
      .pipe($.crisper())
      .pipe(gulp.dest(DEST_DIR))
      .pipe($.size({title: 'vulcanize'}));
  });

The vulcanize task doesn’t run, gulp just exits with no error.

Running vulcanize -p dist /elements/elements.vulcanized.html creates the correct content.