Skip to content

Gilbert09/gulp-css-url-prefix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-css-url-prefix

Prefix urls with a matching pattern in CSS stylesheets

Install

npm install gulp-css-url-prefix

Usage

urlPrefix(prefix, regexMatch)

prefix being what you want prefixed to the url

regexMatch being which url you want to target.

For example you may have background-image: url('/assets/images/bg.png');' and you only want to target the urls beginning with /assets/ and so you would do urlPrefix('http://example.com', '\/assets')

var urlPrefix = require('gulp-css-url-prefix');

gulp.task('css-assets', function() {
  return gulp.src('src.css')
    .pipe(urlPrefix('http://example.com', '\/assets'))
    .pipe(gulp.dest('style.css'));
});

About

Prefix urls with a matching pattern in CSS stylesheets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published