🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

gulp-rebase-css-urls

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-rebase-css-urls

A gulp plugin for rebasing all css urls.

0.0.2
latest
Source
npm
Version published
Weekly downloads
100
25%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-rebase-css-urls

A Gulp plugin for bundling js and css resources as an external reference.

Overview

The plugin is minimalistic and simple. It rebases a chosen css files stream urls to a new base url.

Example

+ src
    - file.css
    + fldr
        - image.jpg
        - file2.css

Where 'file.css' contents are:

.a{
    background-image: url("fldr/image.jpg");
}

and 'file2.css' contents are:

.b{
    background-image: url("image.jpg");
}

And the task:

var rebaseCssUrls = require('gulp-rebase-css-urls'),
    concat = require('gulp-concat');

gulp.task('concat-css-files', ['copy-image-file'], function(){
    return gulp.src('src/**/*.css')
        .pipe(rebaseCssUrls(srcDir))
        .pipe(concat('bundle.css'))
        .pipe(gulp.dest(dstDir));
});

Results in a directory like so:

+ dst
    - bundle.css
    + fldr
        - image.jpg

And a bundle.css contents like so:

.a{
    background-image: url("fldr/image.jpg");
}
.b{
    background-image: url("fldr/image.jpg");
}

Parameters

rebaseCssUrls(base)

base

Type: String

The new base url, comparing to initial file's src.

Testing

Running the gulp file would concat tests/input files into tests/actual and compare the results to a static tests/expected directory, and make sure we got what we've expected.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

Release History

  • 0.0.1 - Basic features.
  • 0.0.2 - Improved tests and added reporting.

License

MIT

Keywords

gulpplugin

FAQs

Package last updated on 29 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts