Giter Club home page Giter Club logo

electron-react-antd-startkit's Introduction

electron-react-antd-startkit

Dependency Status Dependency Status MIT Licensed

构建 Electron + React + AntD 应用,同时应用了 Redux、Thunk、Saga 工具包。

工具链有点复杂,Flow 静态类型检查是个负担 ,少些关注工具链,多花些时间写实际代码。

Flow 工具已移除,优化 ESLint 代码检查,用好 Jest 测试工具。

11

起步方法

克隆项目:

git clone https://github.com/wenris/electron-react-antd-startkit.git project-name

推荐**国内用户使用 taobao.org 源,依赖包下载:

set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/
set ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
yarn install --registry=http://registry.npm.taobao.org

开发常用命令

Flow 静态类型检查:yarn flow

运行热加载开发模式应用程序:yarn dev

其他详见 packages.json 文件。

怎么加入 AntD 包的?

添加 antdless 包:

yarn add -D antd less

增加 app/antd-styles/antd-theme.less 文件,内容如下:

@import "node_modules/antd/lib/style/index.less";
@import "node_modules/antd/lib/style/components.less";

// 定制主题,覆盖上面定义的变量
// @primary-color : #f8900f;

package.json 增加下面 less 编译指令:

"less": "lessc --js ./app/antd-styles/antd-theme.less ./app/antd-styles/antd-theme.css"

定制好 AntD 主题,手动将 antd-theme.less 转译成 antd-theme.css 文件后,引入到 app.global.css 样式中。

再也不要去折腾在工具链中引入 less 支持了,毫无意义。

为什么 Thunk 与 Saga 共用?

因为两者不冲突,优劣势互补,提供了最大的设计弹性。

关于样式表

暂且支持 css 和 scss ,默认导入以 css-module 方式导入,除非文件名以 *.global.css*.global.scss 。在样式表中,除了以 :global 修饰的选择类名都会加以本地命名,比如:

.local-class { ... }
:global(.other-class) { ... }

local-class 将会重写命名,other-class 不会,在 js 代码中使用如下:

import styles from 'mycomponent.css';

function MyComponent((props) => {
  return (<div className={styles["local-class"}/>
    ...
  <div>);
});

electron-react-antd-startkit's People

Contributors

aguynamedben avatar akovalyov avatar akozhemiakin avatar amilajack avatar catalinmiron avatar chentsulin avatar davej avatar domasx2 avatar dplusic avatar dustintownsend avatar epilande avatar g1ibby avatar greenkeeperio-bot avatar hypersprite avatar jefffriesen avatar jhen0409 avatar kilian avatar knpwrs avatar kubijo avatar longlivechief avatar renovate[bot] avatar talha131 avatar trstringer avatar tsemerad avatar vale1534 avatar vikr01 avatar wincent avatar xwartz avatar yeti-or avatar zeevl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

electron-react-antd-startkit'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.