0.1.5 • Published 5 years ago
buit v0.1.5
buit
build src => lib
支持 cssModules 的组件库 compiler
Usage
install
yarn add buitbuild
buit buildwill be transform ./src->./lib
build monorepo
buit build package/awill be transform ./packages/a/src -> ./packages/a/lib
watch
buit build -wcssModules
buit build -cp my-pkg// index.less
.container{
background: #fff
}
// index.tsx
import styles from './index.less';
const Page: React.FC<any> = () => {
return <div className={styles.container}>...</div>;
};
export default Page;transform to =>
// index.less
.my-pkg-container {
color: brown;
}
// index.js
// ...
require("./index.less");
var styles = {
"container": "my-pkg-container"
};
// ...
var Page = function Page() {
return /*#__PURE__*/_react.default.createElement("div", {
className: styles.container
}, "...");
};
// ...Options
Usage: buit build [options] [path]
build src dir, if assign path, will transform './{path}/src' -> './{path}/lib'
Options:
-w, --watch watch change
-t, --target target node or browser, default: node
-c, --cssModules [generateScopedName] open cssModules with generateScopedName, default: [local]__[hash]
-cp, --cssModulesPrefix <prefix> open cssModules and generateScopedName prefix short for [prefix]-[local]
-h, --help display help for command