1 Star 0 Fork 0

duoduo369 / leaning-frontend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Front-end Scaffold for Use with Gulp

Includes CoffeeScript, Webpack for CommonJS-style module wrapping, Backbone for structure, Stylus for CSS pre-processing, sourcemaps for CSS and CoffeeScript, Handlebars for templating, live-reload for automatic page-refreshes during development and Mocha + PhantomJS for unit testing.

Project Setup

  • Install Node
  • Node.js Installer
  • Install Gulp globally
  • sudo npm install -g gulp
  • Clone and cd into the repo
  • git clone https://github.com/WINTR/gulp-frontend-scaffold.git && cd gulp-frontend-scaffold
  • Then install Gulp task dependencies
  • npm install

Development Tasks

  • For development: gulp dev then navigate to http://localhost:3000 (or IP address).
  • For deploy: gulp build

This concatinates and minifies all CoffeeScripts and SASS and moves the project into 'dist' for production deploy.

Bower

Bower is used for client-side package management. Packages installed via bower are then copied over to vendor via gulp bower and each time you run gulp dev.

  • To search for packages
  • bower search {package name}
  • To install a package
  • bower install {package name} --save
  • gulp bower
  • Add the path to the new lib into the concat task in gulpfile.coffee and save

Unit Testing

Mocha is used as the default for unit tests. Via gulp-mocha-phantomjs, unit tests can be run in both the terminal as well as the browser.

  • To execute tests via PhantomJS
  • gulp test
  • To test in browser
  • Run gulp test
  • Navigate to test/html/index.html
  • When running gulp dev, tests are automatically re-run on save of either your source or your spec files and should trigger a reload in the browser.

A Few Notes on Folder Structure

  • Assets like images, audio, webfonts, etc are created in src/assets and will automatically be moved over to the public folder, mirroring the folder structure where they came from.
  • Scripts such as CoffeeScript and JavaScript are placed here and compiled over to public via Webpack.
  • Styles is where SASS files go, and are compiled over to public on save.
  • Vendor is where are vendor sources go, from both Bower (via bower install {package} and then gulp bower) as well as manually. When changes are made to this directory, the GruntFile concat task should be updated to include the newly added files
  • Tests is where your Mocha tests and their accompanying html are located. When developing, test files are continually evaluated and, if need be, compiled into test/spec/spec-runner.js to be run in the browser.
The MIT License (MIT) Copyright (c) 2014 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/duoduo369/leaning-frontend.git
git@gitee.com:duoduo369/leaning-frontend.git
duoduo369
leaning-frontend
leaning-frontend
master

搜索帮助