Coder Social home page Coder Social logo

zeal-cube's Introduction

Zeal Cube

Fork [email protected] 并集成了自定义样式以及[email protected]的部分组件. API文档

安装

npm install zeal-cube --save   

示例

import { DatePicker } from 'zeal-cube';
ReactDOM.render(<DatePicker />, mountNode);

引入样式:

import 'zeal-cube/dist/zeal-cube.css';  // or 'zeal-cube/dist/zeal-cube.less'

你也可以 按需加载组件

发布NPM

npm run pub 

发布前需要更新package.json中的版本号,否则会报错

生成API文档

npm run predeploy 

命令执行结束,会生成_site目录,然后发布到线上服务器。如果只是本地预览可以执行 npm run start

关于组件封装

  • 支持*.jsx,.tsx和.less
  • 源码统一放在components文件夹,目录约定如下:
  |--- ellipsis                                 # 组件名。小写,以“-”连接。如: button、back-top                  
  |    |--- index.zh-CN.md                      # 必须要有,用于生成API文档 
  |    |--- demo                                # 必须要有,否则api文档无法生成对应的demo                  
  |    |    |--- line.md                        # demo1 
  |    |    |--- number.md                      # demo2
  |    |--- index.jsx                           # 组件源码                  
  |    |--- index.less                          # 样式
  |    |--- index.test.js                       # 测试   
  • 组件样式,应使用唯一的命名空间,格式如:cube-组件名
// 禁止使用css module
.cube-ellipsis{

}
  • commit源码之前,内部会自动调用lint进行校验,保证代码的规范

更多规范参考 Airbnb React/JSX Style Guide 英文 | 中文

国际化

参考 国际化文档

支持环境

  • 现代浏览器和 IE9 及以上。
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Opera
Opera
Electron
Electron
IE9, IE10, IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions

FAQs

commit之前,构建工具会自动通过lint-staged命令对*.less、.jsx、.tsx和*md进行校验,保证代码的规范。如下是常见报错以及对于的修改方案

  • Value must be omitted for boolean attributes

表示 默认 属性是true 不需要设置 xxx={true}

  • Trailing spaces not allowed

后面的空格是不允许的

  • .stylelintrc 配置"selector-pseudo-class-no-unknown": null,

允许less中使用:global

  • at-rule-empty-line-before @import、@media 符号必须上面要空一行,且左边顶格
.cube-result {
  text-align: center;
  width: 72%;
  margin: 0 auto;

@media screen and (max-width: @screen-xs) {
    width: 100%;
}
}
  • error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

.eslintrc.js 添加"linebreak-style": 0

zeal-cube's People

Contributors

soonyh avatar

Stargazers

hlsorry avatar

Watchers

 avatar

Forkers

p79n6a kqsmea8

zeal-cube's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.