gobblejs/gobble

wiredep

mohsen1 opened this issue · 2 comments

I noticed there is no wiredep plug-in. Could you provide an example of how I should use wiredep?

A good start is here: https://github.com/gobblejs/gobble/wiki/Writing-plugins

Writing plugins is really simple. I'd start with calling wiredep programmatically: https://github.com/taptapship/wiredep#programmatic-access

I'm not sure if this should be a directory plug-in or a file one. If we make it a file plug-in which makes more sense, it will not give us index.html path that needs to be passed to wiredep. If we make it directory plug-in then it will require specifying src option which is redundant.

Here is my file plug-in

'use strict';


function wiredep (src, options) {

  options.src = src; // src is not the path but the content of index.html

  return require('wiredep')(options);

};

module.exports = wiredep;

wiredep.defaults = {
  /* TODO */
};

Usage

  gobble('client/src/index.html').transform('wiredep', {
    devDependencies: true, 
    bowerJson: require('./bower.json'),
    directory: path.join(__dirname, './bower_components')
  }),

As you can see the problem is src is not the path. How can I access the path of index.html in the plugin?