组件库因为要实现按需加载之类功能,所以是不能直接发布.vue
文件。
vuec
主要致力于让习惯SFC
开发的同学可以使用.vue
开发组件,最终发布js版本。
同时vuec
也遵循了按需加载的逻辑,在组件对应的目录下生成了style/index.css
style/index.js
。
注:暂未发布到npm上
npm i @petrichor/vuec -g
yarn global add @petrichor/vuec
- only command line
vuec --entry ./example/src/ --outDir ./example/output/
- with default config file
// vuec.config.js
const { join } = require('path')
module.exports = {
entry: join(process.cwd(), 'src'),
outDir: join(process.cwd(), 'output')
}
vuec
- with custom config file
// custom.config.js
const { join } = require('path')
module.exports = {
entry: join(process.cwd(), 'src'),
outDir: join(process.cwd(), 'output')
}
vuec --config ./custom.config.js
before compile
|—— src
|—— component
|—— composition.vue
|—— options.vue
|—— test.js
|—— ...
after compile
|—— output
|—— component
|—— style
|—— index.css
|—— index.js
|—— composition.js
|—— options.js
|—— test.js
|—— ...