ez-html-replace
替换html里面script和link标签的引用地址
replace js'
src
and css'href
with their cdn url.
No need for any comments.
You can skip the replacement, when the tag has a
__NOT_REPLACE
attribute
Install
npm install ez-html-replace --save-dev
Example
gulpfile.js
var cdn = ;var cdnUrl = '//www.baidu.com/cnd/'; gulp;
demo.html -- before build
source template
demo.html -- after build
source template
cdn(options)
options
Type: Object
options.forcePrefix
Type: String
Default: ''
Fixed context directory prefix.example : http://www.eajax.cn/cdn/{forePrefix}/css/index.css
options.root
Type: Object
options.root.js
Type: String
The CDN prefix for js files.
options.root.css
Type: String
The CDN prefix for css files.
options.debug
Type: Boolean
Default: false
Output debug log.