@abmaonline/less-tree
v0.2.0
Published
Get less import file tree
Downloads
705
Readme
@abmaonline/less-tree
Get less import vinyl file tree
Originally created by LingyuCoder, but no longer available on github and made some changes to make it more robust.
Installation
$ npm install --save @abmaonline/less-tree
Usage
Create Tree
const lessTree = require('@abmaonline/less-tree');
// create less vinyl file tree
let root = lessTree('a.less');
root.children // => get tree children vinyl file object
toTreeObject
// get tree object
root.toTreeObject();
/*
{
'b.less': {
'd.less': {
'sub/f.less': {}
}
},
'c.less': {
'd.less': {
'sub/f.less': {}
}
},
'sub/e.less': {}
}
*/
toTreeString
// get tree string
root.toTreeString();
/*
├─ b.less
│ └─ d.less
│ └─ sub/f.less
├─ c.less
│ └─ d.less
│ └─ sub/f.less
└─ sub/e.less
*/
Todo
- tree walker
- ...
Test
$ npm run test
$ npm run test-cov