@abmaonline/less-tree

0.2.0 • Public • Published

@abmaonline/less-tree

NPM version node License npm download

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    3
  • 0.1.0
    259

Package Sidebar

Install

npm i @abmaonline/less-tree

Weekly Downloads

122

Version

0.2.0

License

MIT

Unpacked Size

7.33 kB

Total Files

9

Last publish

Collaborators

  • abmaonline