gulp-domain-replace
v1.0.1
Published
A domain replace asset url plugin for gulp
Downloads
5
Readme
gulp-domain-replace
A domain replace asset url plugin for for gulp
Usage
First, install gulp-domain-replace
as a development dependency:
npm install --save-dev gulp-domain-replace
Then, add it to your gulpfile.js
:
Simple domain replace
var domainReplace = require("gulp-domain-replace");
gulp.src("./src/*.html")
.pipe(domainReplace('cdn域名'))
.pipe(gulp.dest("./dist"));
replace with img domain
var domainReplace = require("gulp-domain-replace");
gulp.src("./src/*.html")
.pipe(domainReplace({
imgUrl: '图片cdn域名',
assetsUrl: 'cdn域名'
}))
.pipe(gulp.dest("./dist"));
API
assets(url|options, assetsPath)
url|options
Type: either a string
or a object
Example:
<!-- build:myJsTag -->
<script src="./assets/js/foo.js"></script>
<script src="./assets/css/foo.css"></script>
<!-- endbuild -->
domainReplace('cdn域名', 'assets')