lab cli
1.0.0
Compositor实验室的命令行实用程序和导出模块
npm install @compositor/lab编译lab.json以反应组件:
lab --out-dir dist/注意更改:
lab --out-dir dist/ --watch实验室项目可以以允许将它们安装并导入到应用程序的其他实验室项目的方式发布。
导出index.js , lab.json和theme.json包装实验室项目:
lab --pkg --out-dir dist/ -d --out-dir Output directory
-w --watch Watch for changes
--pkg Include index.js, lab.json, and theme.json in output
Lab App使用节点API将实验室组件导出为反应和其他格式。
lab(config, [options])
返回一系列以写入文件的对象。
const fs = require ( 'fs' )
const path = require ( 'path' )
const lab = require ( '@compositor/lab' )
const config = require ( './lab.json' )
const modules = lab ( config )
modules . forEach ( mod => {
const filename = path . join ( __dirname , 'dist' , mod . name + '.js' )
fs . writeFile ( filename , mod . module , err => {
if ( err ) console . log ( err )
} )
} )library选择输出模式的字符串键,其中之一是:
styled-componentsglamorousemotionfelacxsvue (alpha) harmony布尔值以导出模板而无需转移到ES5语法。
当前,该模块使用模板输出到不同格式。这些模板可以在lib/templates/ 。也可以将AST与Babel这样的工具进行输出,但使用模板是为了使该项目更容易为该项目做出贡献。
请参阅docs/lab-json.md
由Compositor制作|麻省理工学院许可证