gulp-css-path
v1.0.0
Published
Images in the CSS file path can be converted into an absolute path, and add the CDN prefix
Downloads
78
Maintainers
Readme
amdefine
Images in the CSS file path can be converted into an absolute path, and add the CDN prefix
Install
npm install gulp-css-path --save-dev
Usage
const cssUrlToAbsolute = require('gulp-css-path');
gulp.task('CSS_build', function() {
return gulp.src(['./src/**/*.css'])
.pipe(cssUrlToAbsolute({
//relative path
root: './src',
//cdn prefix
cdnpath: '//img.xxx.com/dist/img/'
}))
.pipe(gulp.dest(DIST_PATH))
});
example
1) css
.label {
width: 57px;
height: 69px;
background: url(../../common/img/label.png) center center no-repeat;
}
2) convert after
.label {
width: 57px;
height: 69px;
background: url(//img.xxx.com/dist/img/help/label/common/img/label.png) center center no-repeat;
}
License
New BSD and MIT. Check the LICENSE file for all the details.