inline-css-imports

0.2.1 • Public • Published

Inline css @imports

NPM version Build Status

You have a css string with @import statements, you want them resolved and inlined into said css string. Code mostly adapted from the css @import part of inliner. Recursively inlines css imports, so works for nested @imports too.

Still relatively early days, use with caution.

Requirements

Node@^0.12 (could use earlier version if you polyfilled Promise).

Usage

npm install --save inline-css-imports

import inlineCssImports from 'inline-css-imports'

// css -- string || css to inline imports inside
// baseUrl -- string || url where css is hosted - required to resolve relative import paths

inlineCssImports(css, baseUrl)
.then(function (updatedCss) {
  console.log('I have all css @imports inlined!', updatedCss)
})

Note

Will just remove @import for css that doesn't exist.

Readme

Keywords

Package Sidebar

Install

npm i inline-css-imports

Weekly Downloads

1

Version

0.2.1

License

ISC

Unpacked Size

18 kB

Total Files

27

Last publish

Collaborators

  • pocketjoso