Coder Social home page Coder Social logo

backbone_web_eslint's Introduction

generate-sapling-pc

Build Status

音悦台PC端项目脚手架,项目所使用的工具如下:

Node version v4.4.1

  • webpack
  • bower
  • npm scripts
  • browser-sync

How use it?

download project

git clone https://github.com/sapling-team/generator-sapling-pc.git

remove git origin and add your project new origin

git remote remove origin

git remote add origin [email protected]:sapling-team/generator-sapling-pc.git

git pull

install global bower

npm install -g bower

execute npm install

npm install --verbose

we can using npm scripts start dev product test

  • npm start 启动一个服务器
  • npm test 启动mocha进行自动化测试
  • npm run dev 启动webpack dev构建环境
  • npm run product 启动webpack product + gulp build构建可发布的资源

tools.js

你可以使用tools.js来快速的生成modelview文件,这样可以避免很多重复性的劳动。

node tools.js name.view ./app/src/views

include

在编译期来决定最终呈现什么样的HTML,使用jade的include特性来组合你的HTML。

image

写在HTML中的image推荐大家使用js的方式来处理:

var imgSrc = require('../../../images/change.gif');
this.imgContainer.html('<img src="'+imgSrc+'"/>');

compile.config

配置你的config文件,这个文件主要针对不是webpack打包而是用script方式创建的优化

{
  "random":true,
  "script":[
      "jquery/dist/jquery.min.js",
      "underscore/underscore-min.js",
      "backbone/backbone-min.js"
  ],
  "style":[],
  "title":{
    "index":"webpack index",
    "code":"webpack code"
  }
}

模块化

js使用commonjs模块化规范来组织

CDN

使用npm run build时可以在webpack.product.config.js文件中找到publicPath替换成你使用的CDN地址。

eslint

commit阶段会做一次review,如果不通过eslint将不会触发git commit hook来提交源代码,我们使用了https://github.com/typicode/husky这个工具帮助我们做了shell脚本。

基础库

  • jquery
  • underscore
  • backbone
  • base-extend-backbone
  • now-extend-modules

阅读base-extend-backbone APInow-extend-modules来熟悉如何使用base扩展和其他通用的函数库。

第三方库处理

如果是不支持commonjs语法的第三方插件或者库,你可以使用导出的方式,建议你放置在link目录下。

backbone_web_eslint's People

Watchers

James Cloos avatar fenger avatar

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.