All Projects → bodyno → React Starter Kit

bodyno / React Starter Kit

Licence: other
完美使用 React, Redux, and React-Router!超好用的脚手架

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to React Starter Kit

Reactly Starter Kit
Deployable React + Webpack 2 starter kit
Stars: ✭ 122 (-93.05%)
Mutual labels:  webpack, babel
Iceberg
Front-End Boilerplate built with React + Babel + Webpack + SASS
Stars: ✭ 144 (-91.79%)
Mutual labels:  webpack, babel
Serverless Prisma
AWS Serverless Prisma Boilerplate
Stars: ✭ 126 (-92.82%)
Mutual labels:  webpack, babel
Vue Starter
🐩 A boilerplate for HTML5, Vue, Vue Router, i18n, Tailwind, Windi, Netlify, and Vite.
Stars: ✭ 120 (-93.16%)
Mutual labels:  webpack, babel
React Pages Boilerplate
Deliver react + react-router application to gh-pages
Stars: ✭ 134 (-92.36%)
Mutual labels:  webpack, babel
Across Tabs
Easy communication between cross-origin browser tabs. Simplified "CORS"ing!
Stars: ✭ 1,575 (-10.26%)
Mutual labels:  webpack, babel
Webpack Starter
✨ A lightweight foundation for your next webpack based frontend project.
Stars: ✭ 1,745 (-0.57%)
Mutual labels:  webpack, babel
React Redux Auth0 Kit
Minimal starter boilerplate project with CRA, React, Redux, React Router and Auth0 authentication
Stars: ✭ 115 (-93.45%)
Mutual labels:  webpack, babel
Angular2 Esnext Todomvc
Angular TodoMVC application in Javascript (ES6/ES7).
Stars: ✭ 132 (-92.48%)
Mutual labels:  webpack, babel
Modern Javascript
Code for TylerMcGinnis.com's "Modern JavaScript" course
Stars: ✭ 130 (-92.59%)
Mutual labels:  webpack, babel
Vue Spa Project
vue.js + vuex + vue-router + fetch + element-ui + es6 + webpack + mock 纯前端SPA项目开发实践
Stars: ✭ 118 (-93.28%)
Mutual labels:  webpack, babel
Preact Minimal
🚀 Minimal preact structure
Stars: ✭ 136 (-92.25%)
Mutual labels:  webpack, babel
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (-6.95%)
Mutual labels:  webpack, babel
Book
《现代化前端工程师权威指南》https://guoyongfeng.github.io/book/
Stars: ✭ 141 (-91.97%)
Mutual labels:  webpack, babel
Simple Boilerplate
A simple webpack boilerplate for your comfortable work with HTML, JS and CSS.
Stars: ✭ 116 (-93.39%)
Mutual labels:  webpack, babel
Mhy
🧩 A zero-config, out-of-the-box, multi-purpose toolbox and development environment
Stars: ✭ 128 (-92.71%)
Mutual labels:  webpack, babel
React Workshop
⚒ 🚧 This is a workshop for learning how to build React Applications
Stars: ✭ 114 (-93.5%)
Mutual labels:  webpack, babel
Raw.macro
Read file contents at build time via babel-plugin-macros. webpack-less raw-loader
Stars: ✭ 115 (-93.45%)
Mutual labels:  webpack, babel
Webpack Babel Env Deps
Find dependencies to transpile with Babel.
Stars: ✭ 130 (-92.59%)
Mutual labels:  webpack, babel
170330 webpack
「最新版で学ぶwebpack入門」のサンプルコード集です。ReactやBabelなど30以上の構成のサンプルを用意しています。
Stars: ✭ 135 (-92.31%)
Mutual labels:  webpack, babel

废弃警告

这个项目起始于Redux生态的开始,目的是提供一个手脚架让前端们快速上手和开始。之后,工具和最佳实践被不断的革新。为了获得最新的体验,我推荐你使用类似于create-react-app这种可以支持React核心和Redux的脚手架。

当然还是欢迎你继续使用这个项目如果你觉得这个项目更适合你。如果你是个追求新生态的人,我还是强烈推荐你使用其它更新更频繁的项目。

谢谢大家在过去这些年为这个项目的贡献。Thanks everyone.

React Starter Kit

React开发中最好用的脚手架。

这个启动包的设计是为了让你使用一整套最新最酷的前端技术,所有都是可配置,富特性,基于webpack已经提供代码热加载,使用sass预处理css,单元测试,代码覆盖率报告,代码分割等等更多。

这个项目最主要的目的是尽可能果断的保留。目的不是要你一定按照这个结构去完成你的项目,谐在使前端开发更健壮,更简单还有最重要的是更快乐。你可以获得以下的所有特性!

最后,如果没有大家的贡献,这个项目是不可能如此健壮的。

所有相关库已准备好,随时等待调用。

特性

需求配置

  • node ^4.5.0
  • npm ^3.0.0

开始

确认好你的环境配置,然后就可以开始以下步骤。

$ git clone https://github.com/bodyno/react-starter-kit.git
$ cd react-starter-kit
$ npm install                   # Install project dependencies
$ npm start                     # Compile and launch

如果一切顺利,你会看到如下:

开发过程中,你用得最多的会是npm start,但是这里还有很多其它的处理:

npm run <script> 解释
start 服务启动在3000端口,代码热替换开启。
compile 编译程序到dist目录下(默认目录~/dist)。
dev npm start相同, 但是启动nodemon守护进程。
dev:no-debug npm run dev 但是禁用devtool(开发工具)。
test 开启Karma测试并生成覆盖率报告。
test:dev 开启Karma测试并监听改变随时重新测试,但是生成覆盖率报告。
deploy 启动代码检查,测试,如果成功,编译到dist目录下。
deploy:dev deploy相同,但是NODE_ENV值为"development"。
deploy:prod deploy相同,但是NODE_ENV值为"production"。
lint 检查所有.js文件是否规范。
lint:fix 检查所有.js文件是否规范并修复它们。 更多

程序目录

这个项目的结构使用的是 fractal(不规则碎片形:适合大型项目)*,方法的分组主要是依照特性而不是文件类型。注意,这个目录结构只是一个指引,并不一定要按这个来。这种结构谐在让程序更容易扩展,想了解更多请点击这里

.
├── bin                      # 启动脚本
├── blueprints               # redux-cli的蓝图
├── build                    # 所有打包配置项
│   └── webpack              # webpack的指定环境配置文件
├── config                   # 项目配置文件
├── server                   # Express 程序 (使用 webpack 中间件)
│   └── main.js              # 服务端程序入口文件
├── src                      # 程序源文件
│   ├── main.js              # 程序启动和渲染
│   ├── components           # 全局可复用的表现组件(Presentational Components)
│   ├── containers           # 全局可复用的容器组件
│   ├── layouts              # 主页结构
│   ├── static               # 静态文件(不要到处imported源文件)
│   ├── styles               # 程序样式
│   ├── store                # Redux指定块
│   │   ├── createStore.js   # 创建和使用redux store
│   │   └── reducers.js      # Reducer注册和注入
│   └── routes               # 主路由和异步分割点
│       ├── index.js         # 用store启动主程序路由
│       ├── Root.js          # 为上下文providers包住组件
│       └── Home             # 不规则路由
│           ├── index.js     # 路由定义和代码异步分割
│           ├── assets       # 组件引入的静态资源
│           ├── components   # 直观React组件
│           ├── container    # 连接actions和store
│           ├── modules      # reducers/constants/actions的集合
│           └── routes **    # 不规则子路由(** 可选择的)
└── tests                    # 单元测试

样式

所有的css和sass都支持会被预处理。只要被引入,都会经过PostCSS压缩,加前缀。在生产环境下会提取到一个css文件下。

服务端

这个项目的服务端使用Koa。需要注意的是,只有一个目的那就是提供了webpack-dev-middlewarewebpack-hot-middleware(代码热替换)。使用自定义的Koa程序替换webpack-dev-server,让它更容易实现universal 渲染和为了不使这个包过于庞大。

打包优化

Babel被配置babel-plugin-transform-runtime可以让代码更优化。另外,在生产环境,我们使用react-optimize来优化React代码。

在生产环境下,webpack会导出一个css文件并压缩Javascript,并把js模块优化到最好的性能。

静态部署

如果你正在使用nginx处理程序,确保所有的路由都直接指向 ~/dist/index.html 文件,然后让react-router处理剩下的事。如果你不是很确定应该怎么做,文档在这里。Express在脚手架中用于扩展服务和代理API,或者其它你想要做的事,这完全取决于你。

谢谢大家

如果没有大家的贡献,这个项目是不可能诞生的, 感谢所有为这个项目做出贡献的人。

This program is inspired by davezuko

  • Justin Greenberg - For all of your PR's, getting us to Babel 6, and constant work improving our patterns.
  • Roman Pearah - For your bug reports, help in triaging issues, and PR contributions.
  • Spencer Dixin - For your creation of redux-cli.
  • Jonas Matser - For your help in triaging issues and unending support in our Gitter channel.

Thanks you guys all the time.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].