@nuintun/css-deps
v2.2.1
Published
Transform css and get css dependences.
Downloads
12
Readme
css-deps
Transform css and get css dependences
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
- options { media:Boolean, onpath:Function }
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: [] }];