resolve-css-import-urls

4.0.0 • Public • Published

resolve-css-import-urls Build Status js-standard-style

Parse css import statements (@import url(bar.css)) in a string and return the full urls (http://foo.com/bar.css).

Support for the following @import syntax:

@import url("fineprint.css") print;
@import 'custom.css' projection;
@import "custom.css";

TODO: Support the following

@import "common.css" screen, projection;
@import url('landscape.css') screen and (orientation:landscape);
@import url("bluish.css") projection, tv;

Installation

npm i --save resolve-css-import-urls

Usage

const resolveCssImportUrls = require('resolve-css-import-urls')

resolveCssImportUrls('http://example.com/css', 'url(foo.css); lksjhlksjhdf url(../bar.css);')
// => ['http://example.com/css/foo.css', 'http://example.com/bar.css']

resolveCssImportUrls("(foo.css); lksjhlksjhdf") // => []

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander.


This package was initially generated with yeoman and the p generator.

Package Sidebar

Install

npm i resolve-css-import-urls

Weekly Downloads

3,035

Version

4.0.0

License

MIT

Unpacked Size

4.2 kB

Total Files

4

Last publish

Collaborators

  • johno