@nuintun/css-deps

2.2.1 • Public • Published

css-deps

Transform css and get css dependences

NPM Version Download Status Dependencies

Api

  • parseDependencies(code:String|Buffer, replace:Function, options:Object):Object
  • parseDependencies(code:String|Buffer, options:Object):Object
    • options { media:Boolean, onpath:Function }
      • media: parse import media query
      • onpath: replace css resource file url

Example

css:

@import 'reset.css';
@import 'base.css';

html,
body {
  height: 100%;
  width: 100%;
  font-size: 13px;
  font-family: Microsoft Yahei, SimSun, sans-serif;
}

js:

const parseDependencies = require('css-deps');
const dependencies = parseDependencies(source).dependencies;

// print dependencies
console.log(dependencies);

parser output:

[{ path: 'reset.css', media: [] }, { path: 'base.css', media: [] }];

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @nuintun/css-deps

Weekly Downloads

6

Version

2.2.1

License

MIT

Unpacked Size

11 kB

Total Files

7

Last publish

Collaborators

  • nuintun