Open unkstar opened 10 years ago
I develop this feature because I have to put a web worker's script on CDN, and inspired by pattern option from grunt-usemin
new option work like this:
//define worker type function Worker_cdn() { }; Worker_cdn.prototype = { run : function() { var self = this; return this.buffer.replace(/new\s+Worker\(\s*['"]([^"']+)['"]/gm, function(match, url) { return match.replace(url, self._replace(url)); }); } }; //and add it to supported type cdn: { options: { cdn:'http://example.com/static/', flatten:false, supportedTypes:{"js":Worker_cdn} }, dist: { src: [ '<%= yeoman.dist %>/*.html', '<%= yeoman.dist %>/scripts/*.js' ] } }
This patch let user inherit from Job interface directly, this give user great flexibility, or maybe too much? Job._replace may need a better name too.
4dadf75 fix the same problem as #45 , I prefer #45 than my own solution, please pull #45 intead
By the way, I can't find a reasonable way to write a test on this feature in orignial tests framework, it need a fully functioning grunt to work.
I develop this feature because I have to put a web worker's script on CDN, and inspired by pattern option from grunt-usemin
new option work like this:
This patch let user inherit from Job interface directly, this give user great flexibility, or maybe too much? Job._replace may need a better name too.