gulp-fez-cdn
添加静态资源CDN地址
Last updated a year ago by furic-zhao .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-fez-cdn 
SYNC missed versions from official npm registry.

gulp-fez-cdn

添加静态资源CDN地址

install

npm install gulp-fez-cdn --save-dev

Usage

    gulp.task('cdnify', function () {

      var cdnify = require('gulp-fez-cdn');

      return gulp.src([
        'dist/**/*.{css,html}'
      ])
      .pipe(cdnify({
        base: 'http://pathto/your/cdn/'
      }))
      .pipe(gulp.dest('dist/'))
    });

For those who want to rewrite the url with their own specific rules.

pipe($.cdnify({
  rewriter: function(url, process) {
    if (/eot]ttf|woff|woff2/.test(url)) {
      return 'http://myfontcdn.com/' + url;
    } else if (/(png|jpg|gif)$/.test(url)) {
      return 'http://myimagecdn.com/' + url;
    } else {
      return process(url);
    }
  }
}));

If you want to read custom source (Eg. favicon)

pipe($.cdnify({
  html: {
    'link[rel="shortcut icon"]': 'href',
    'link[rel="apple-touch-icon-precomposed"]': 'href'
  }
}));

Default sources:

sources = {
  'img[src]': 'src',
  'link[rel=stylesheet]': 'href',
  'script[src]': 'src',
  'video[poster]': 'poster',
  'source[src]': 'src'
}

Current Tags

  • 1.0.4                                ...           latest (a year ago)

5 Versions

  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 5
This Month 5
Last Day 0
Last Week 3
Last Month 6
Dependencies (5)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |