Giter Site home page Giter Site logo

web-not-for-them's People

Contributors

solocao avatar

Stargazers

 avatar  avatar  avatar JGer avatar  avatar

Watchers

James Cloos avatar  avatar

web-not-for-them's Issues

mvp原则

最简化可实行产品原则, 示例:

既有项目引入新的组件/库

假设现有项目用到了 react, react-router , antd 等库, 并且 controller, router, model, view 已基本成型.

此时如果要引入 mobx, 最佳实践步骤为:

  1. 新建一个空项目, 将既有库 react, antd 等安装, 配置一个最简单的 hello world 路由
  2. 安装 mobx, 引入并测试通过
  3. 再在原有项目上进行功能扩充

既有项目打包优化

假设现有项目用到了 react, react-router , antd, mobx 等库, 并且 controller, router, model, view 已基本成型. webpack打包过大, 应用性能较差.

最佳实践步骤:

  1. 新建一个空项目, 新建一个空的webpack配置
  2. 安装 react (或 antd, 或 mobx等) 写一个简单示例引入项目
  3. 针对单一库进行 webpack 打包优化, 一般情况下, 除了 loader rules / vendor 需要每个库单独优化, 其他配置都能保证通用
  4. 一项优化完成后重复2,3步骤, 直到所有库优化完成
  5. 对原有项目的 webpack 配置进行替换, 不动项目源码
  6. 进一步优化, 比如 react-router-loader 之类的引入, 开始针对项目源码进行优化

webpack相关经验整理: https://leader.js.cool/#/basic/framework/webpack

eslint 相关讨论

LF/CRLF

Windows下如何用LF:

单一文件

wx20170804-221559 2x

IDE配置

wx20170804-221648 2x

(仅以vs code为例)

GIT 自动转换

如果你文件编码是UTF8并且包含中文文字,那还是把autocrlf设置为false,并且把所有文件转换为Linux编码(即LF \n),开启safecrlf检查。

一、AutoCRLF

#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true   

#提交时转换为LF,检出时不转换
git config --global core.autocrlf input   

#提交检出均不转换
git config --global core.autocrlf false

二、SafeCRLF

#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true   

#允许提交包含混合换行符的文件
git config --global core.safecrlf false   

#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

说明

源码一般都以 LF 作为规范, 一方面是因为大部分部署的服务器是 UNIX 系统, 另外一方面是 GIT 代码托管服务上大部分默认以 LF 存储

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.