jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

Pass _basePath to useref via options #188

Closed ghost closed 8 years ago

ghost commented 8 years ago

I need gulp-useref to pass the _basePath variable that it uses in vfs.glob base to useref, so that I have access to it from within my custom block handler, so that I can push files to the stream and they will be output identically to useref internal block handlers.

import: function importer (content, target, options, alternateSearchPath, basePath) {
  //...
  let file = new vinyl({
    base: basePath,
    path: target,
    contents: buffer,
  })
  stream.push(file)
  return `<script src="${target}"></script>`
}
jonkemp commented 8 years ago

Can you provide tests for these? Sorry for the slow response.

jonkemp commented 8 years ago

No response.