<!DOCTYPE html>
<html>
<head>
<link href="./css/example.css" />
</head>
<body>
<img src="./example.jpg" />
<script type="text/javascript" src="./js/example.js"></script>
</body>
</html>
var urlPrefix = require('gulp-html-url-prefix-custom'),
gulp = require('gulp');
gulp.task('url', function() {
gulp.src(['index.html'])
.pipe(urlPrefix({
prefix: '//cdn.xxx.com';
attrdata: ["img:src", "img:srcset", "img:s-src", "img:data-src", "script:src", "link:href"]
}))
.pipe(gulp.dest('./'));
});
<!DOCTYPE html>
<html>
<head>
<link href="//cdn.xxx.com/css/example.css" />
</head>
<body>
<img src="//cdn.xxx.com/example.jpg" />
<script type="text/javascript" src="//cdn.xxx.com/js/example.js"></script>
</body>
</html>