0.4.1 • Published 10 years ago

gulp-cdn-ref v0.4.1

Weekly downloads
10
License
MIT
Repository
github
Last release
10 years ago

gulp-cdn-ref

change urls in css/js files to cdn-based version

install

$ npm i gulp-cdn-ref --save-dev

usage

var gulp=require('gulp');
var replace=require('gulp-cdn-ref');

gulp.task('cdnref',function(){
    return gulp.src('test/fixtures/**/*')
        .pipe(replace({
            base: 'fixtures',
            cdn: 'http://lisposter.b0.upaiyun.com'
        }))
        .pipe(gulp.dest('test/expected/'));
});

and

$ gulp cdnref

See example in test

config object

var config = {
    cdn: 'http://lisposter.b0.upaiyun.com',
    base: 'assets',
    map: {
        //...
    }
}
  • cdn: your cdn service url.
  • base: the root dir of this website.

eg. here is a files tree:

project
├── style 
│   └── style.css
├── assets 
│   └── images
|           └── bg.png

and, here is the css:

.bg {
    background: url(../assets/bg.png) repeat;
}

so, the config may be:

var config = {
    cdn: 'http://lisposter.b0.upaiyun.com',
    base: 'project'
}

this can make your css like this:

.bg {
    background: url(http://lisposter.b0.upaiyun.com/assets/bg.png) repeat;
}
0.4.1

10 years ago

0.4.0

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.0

10 years ago