gulp-css-url-basename
Keep only the basename of url()
Last updated 5 years ago by yshadowz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-css-url-basename 
SYNC missed versions from official npm registry.

gulp-css-url-basename

====================

Build Status

Gulp plugin for mapping url() calls. Skip the encoded ones, and replace path in rest url()s with basename(Unix).

var basename = require('gulp-css-url-basename');
gulp.src('test/url.css')
    .pipe(basename({prefix: 'assets'}))
    .pipe(rename('url-out.css'))
    .pipe(gulp.dest('test'))

origin:

body {
  background: url(/images/bg.png);
}
@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix'),
    url(" ../fonts/glyphicons-halflings-regular.woff ") format('woff');
}
.icon {
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAlElEQVQoU33PPQrCQBRF4fFnI2KfZVi5ARvdgo1l6mwmkCJVOgluwd5OwUoDtnoOxAei8cLXTN7cvEl/skCNDCMPfsUPO5zQwOHIDEvYtMURHe6wOVLgigvOePRyeDkyR4ln7wZ//7XfFBu8B23+aDJjrHGAwza7hjtHJvDmHg7b7Bru7AMjK7Rw2ObBVHDY5oGk9AKQNB2zy8MBTgAAAABJRU5ErkJggg==");
}

yields:

body {
  background: url("assets/bg.png");
}
@font-face {
  font-family: 'Glyphicons Halflings';
  src: url("assets/glyphicons-halflings-regular.eot?#iefix"),
    url("assets/glyphicons-halflings-regular.woff") format('woff');
}
.icon {
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAlElEQVQoU33PPQrCQBRF4fFnI2KfZVi5ARvdgo1l6mwmkCJVOgluwd5OwUoDtnoOxAei8cLXTN7cvEl/skCNDCMPfsUPO5zQwOHIDEvYtMURHe6wOVLgigvOePRyeDkyR4ln7wZ//7XfFBu8B23+aDJjrHGAwza7hjtHJvDmHg7b7Bru7AMjK7Rw2ObBVHDY5oGk9AKQNB2zy8MBTgAAAABJRU5ErkJggg==");
}

Options

  • prefix The target directory added before the basename.
  • normalize Use path.normalize to process the options.prefix or not. default: false

Current Tags

  • 0.1.0                                ...           0.1.0 (5 years ago)
  • 0.1.3                                ...           latest (5 years ago)

4 Versions

  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |