Socket
Book a DemoInstallSign in
Socket

postcss-map-url

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-map-url

PostCSS plugin that maps over each `url` property in a declaration

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

postcss-map-url Build Status

Ported from rework-plugin-url

PostCSS plugin that maps over each url property in a declaration.

Installation

$ npm install postcss-map-url --save-dev

.mapUrl(mapFn)

Takes a callback function that recieves the url

Usage

var fs = require('fs');
var postcss = require('postcss');
var mapUrl = require('postcss-map-url');

var css = fs.readFileSync('input.css', 'utf8');

var output = postcss()
  .use(mapUrl(myMapFunc))
  .process(css)
  .css;

// Your map function that takes the url as a parameter and
// should return a modified url
function myMapFunc(url) {
  return 'http://example.com' + url;
}

Input

body {
  background: url(/images/bg.png);
}

Output

body {
  background: url(http://example.com/images/bg.png);
}

See PostCSS docs for examples for your environment.

Keywords

postcss

FAQs

Package last updated on 01 Apr 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