HuiWang111 / vuec

sfc compiler cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@petrichor/vuec

组件库因为要实现按需加载之类功能,所以是不能直接发布.vue文件。 vuec主要致力于让习惯SFC开发的同学可以使用.vue开发组件,最终发布js版本。 同时vuec也遵循了按需加载的逻辑,在组件对应的目录下生成了style/index.css style/index.js

:暂未发布到npm上

Install

npm i @petrichor/vuec -g
yarn global add @petrichor/vuec

Usage

  1. only command line
vuec --entry ./example/src/ --outDir ./example/output/
  1. with default config file
// vuec.config.js
const { join } = require('path')

module.exports = {
    entry: join(process.cwd(), 'src'),
    outDir: join(process.cwd(), 'output')
}
vuec
  1. 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

Effect

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
    |—— ...

About

sfc compiler cli


Languages

Language:JavaScript 66.2%Language:TypeScript 26.3%Language:Vue 6.0%Language:CSS 1.4%