Created
June 29, 2016 20:27
-
-
Save drFabio/8df47f550bfb82f143bccad6a62c37a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyPlugin.prototype.apply = function(compiler) { | |
compiler.plugin("entry-option", function(context, entry) { | |
function itemToPlugin(item, name) { | |
if(Array.isArray(item)) | |
return new MultiEntryPlugin(context, item, name); | |
else | |
return new SingleEntryPlugin(context, item, name); | |
} | |
compiler.apply(itemToPlugin(entry,'main')); | |
compiler.apply(itemToPlugin(__dirname+'/someFile.md','target/name')); | |
// if(typeof entry=== 'string'){ | |
// entry = [entry,__dirname+'/test.md'] | |
// } | |
// else if (Array.isArray(entry)){ | |
// entry.push(__dirname+'/test.md') | |
// } | |
// else{ | |
// entry['opa'] = __dirname+'/test.md' | |
// } | |
// if( Array.isArray(entry)) { | |
// compiler.apply(itemToPlugin(entry, "main")); | |
// } else if(typeof entry === "object") { | |
// Object.keys(entry).forEach(function(name) { | |
// compiler.apply(itemToPlugin(entry[name], name)); | |
// }); | |
// } | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment