Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiangjie/gulp-cdn-replace
替换html里面js和css引用地址
https://github.com/jiangjie/gulp-cdn-replace
Last synced: 27 days ago
JSON representation
替换html里面js和css引用地址
- Host: GitHub
- URL: https://github.com/jiangjie/gulp-cdn-replace
- Owner: JiangJie
- License: mit
- Created: 2014-11-06T09:50:07.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-26T11:09:24.000Z (almost 8 years ago)
- Last Synced: 2024-04-26T14:03:46.228Z (7 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 11
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gulp-cdn-replace
================> 替换html里面js和css引用地址
> replace js' `src` and css' `href` with their cdn url.
> No need for `` comments.
## Install
```
npm install gulp-cdn-replace --save-dev
```## Example
### `gulpfile.js`
```js
var cdn = require('gulp-cdn-replace');gulp.task('cdn', function() {
gulp.src('./src/*.html')
.pipe(cdn({
dir: './dist',
root: {
js: 'http://cdn.example.com/somename',
css: 'http://cdn.example.com/somename'
}
}))
.pipe(gulp.dest('./dist'));
});
```### cdn(options)
### options
Type: `Object`
#### options.dir
Type: `String`
Default: './dist'The directory where you place your js and css which may be created by `gulp-rev`.
#### 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.root.cssImg
Type: `String`The CDN prefix for css images.
#### options.inlineReplace
Type: `Boolean`
Default: `true`Whether replace tag with `inline` attribute.
The CDN prefix for css files.