Closed elisechant closed 9 years ago
Sorry for late response, actually, there is a powerful method allowing us to do this.
rewrite: function(url, process) {
return "whatever you want";
}
The url
is the path extracted from src, the process
is the default convert function.
Sample usage:
pipe($.cdnify({
rewriter: function(url, process) {
if (/eot]ttf|woff|woff2/.test(url)) {
return 'http://myfontcdn.com/' + url;
} else if (/(png|jpg|gif)$/.test(url)) {
return 'http://myimagecdn.com/' + url;
} else {
return process(url);
}
}
}));
It would be useful if gulp-cdnify supported different CDN hosts for different asset extensions. For example, assets with font extensions and image assets. Something like: