@abmaonline/parse-less-import 中文文档教程
@abmaonline/parse-less-import
从 less 文件中解析导入
最初由 LingyuCoder,但在 github 上不再可用,并进行了一些更改以使其与旧版本的 less 一起使用。
Node.js >= 6
Install
$ npm install --save @abmaonline/parse-less-import
Usage
const parse = require('@abmaonline/parse-less-import');
const content = `
@import '../a';
@import './b.less';
@import (multiple) './c.less';
@import (multiple, reference) './d.less';
`;
parse(content);
/*
[ { path: '../a', keywords: [] },
{ path: './b.less', keywords: [] },
{ path: './c.less', keywords: [ 'multiple' ] },
{ path: './d.less', keywords: [ 'multiple', 'reference' ] } ]
*/
Test
$ npm run test
$ npm run test-cov
@abmaonline/parse-less-import
Parse import from less file
Originally created by LingyuCoder, but no longer available on github and made some changes to make it work with older versions of less.
Node.js >= 6
Install
$ npm install --save @abmaonline/parse-less-import
Usage
const parse = require('@abmaonline/parse-less-import');
const content = `
@import '../a';
@import './b.less';
@import (multiple) './c.less';
@import (multiple, reference) './d.less';
`;
parse(content);
/*
[ { path: '../a', keywords: [] },
{ path: './b.less', keywords: [] },
{ path: './c.less', keywords: [ 'multiple' ] },
{ path: './d.less', keywords: [ 'multiple', 'reference' ] } ]
*/
Test
$ npm run test
$ npm run test-cov
更多