JSPM

gulp-cssretarget

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q44969F
  • License MIT

Retarget relative CSS URLs during asset rebasing.

Package Exports

  • gulp-cssretarget

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-cssretarget) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-cssretarget

Retarget relative CSS URLs during asset rebasing.

Install

npm install gulp-cssretarget --save

Example usage

var cssRetarget = require('gulp-cssretarget');
var useref = require('gulp-useref');
var concat = require('gulp-concat');
var gulpif = require('gulp-if');
...

var userefAssets = useref.assets({
  noconcat: true // preserve paths for gulp-cssretarget
});

// retargets relative URLs when moving from www to dist
return gulp.src('www/index.html')
  .pipe(userefAssets)
  .pipe(gulpif('**/*.css', cssRetarget({ root: 'www' })))
  .pipe(gulpif('**/*.css', concat('style.css')))
  .pipe(gulpif('**/*.js', concat('style.js')))
  .pipe(userefAssets.restore())
  .pipe(gulp.dest('dist'));

Options

options.root

Type: String Default value: ''

The directory relative to which paths are determined.

options.prepend

Type: String Default value: ''

String prepended to each asset URL.

options.suffix

Type: String Default value: ''

String added before the final extension of each asset URL (useful for proper cache busting, works great with gulp-rename's suffix option).

Example with { suffix: "-1.2.0" }:

[retarget] images/my-image.png => images/my-image-1.2.0.png ✔
[retarget] images/my-image.small.png => images/my-image.small-1.2.0.png ✔
[retarget] images/my-image.png?size=small => images/my-image-1.2.0.png?size=small ✔
[retarget] images/my-image.png#size=small => images/my-image-1.2.0.png#size=small ✔

options.silent

Type: Boolean Default value: false

Don't log the rebased URLs.

Release History

1.2.0

Add suffix option (@sp00m)

1.1.4

Add silent option (@monestereo)

1.1.3

Fix undefined color format. Bump deps.

1.1.2 - 1.1.1

Update docs, refresh package

1.1.0

Add prepend option

1.0.0

Initial release

Originally forked from gulp-css-rebase-urls