I wrote a plugin gulp-cdnizer, in particular, to help in this situation.
It is designed so that you can locally store all CDN sources during development, and then, when creating the distribution, replace the local path with the CDN path.
, HTML . gulp-inject gulp-cdnizer CDN.
gulp.task('source', function () {
return gulp.src("src/my.html")
.pipe(inject(sources))
.pipe(cdnizer([
{
package: 'jasmine',
file: 'bower_components/jasmine/jasmine.js',
cdn: 'http://cdnjs.cloudflare.com/ajax/libs/jasmine/${version}/jasmine.js'
}
])
.dest("dest/")
});
, . cdnizer , , , CDN ( - ).