Note: This generator is supporting a very early stage app,things gonna change very frequently,so please do not fork it or do any pull request.
webappstarter generator will give you a Simple Mobile Web App Boilerplate and Structure!
The App will automatically adjusts according to a device’s screen size without any extra work.
npm install -g generator-webappstarter
2.install yeoman.
npm install -g yo
3.[optional]Clone this git repo to your local,and from the root of the repo,run
npm link
to developing the generator locally.
1.generate a new project,run
mkdir myProject
cd myProject
yo webappstarter
or run with --skip-install
option to skip install dependencies
mkdir myProject
cd myProject
yo webappstarter --skip-install
install dependencies manually with npm install
or just copy node_modules
folder from another project which was generated by webappstarter.
2.generate a new module,run
//this command will do:
//add "html/include/view-modulename.html" and inlude it to "html/include/views.html"
//add "scss/_view-modulename.scss" and import it to "scss/_view.scss"
//add "src/app/view/ModuleNameView.js"
//add "src/app/controller/ModuleNameController.js" and require it in src/app/App.js
yo webappstarter:module ModuleName
3.generate a new model,run
//this command will do:
//add "src/app/model/ModelNameModel.js"
yo webappstarter:model ModelName
4.update your project's boilerplate and structure
//this command will update
//"./src/core" directory
//"./src/lib" directory
//"./src/util" directory
//"./src/widget" directory
//some files in "./src/app/" directory
//some files in "./scss/" directory
//some files in "./html/" directory
yo webappstarter:update
Warning: When you are asked before an overwrite can occur,please be careful.Default "Y" is overwrite,"n" is skip.
More configurations,please take a look at "project" property of "package.json" file after the generator is done.Run gulp
to re-build project is required after change the "package.json" file.
run this command before you get started.
npm install -g gulp
1.build project,watch change and start browserSync,run
gulp
or run with forever
forever ./node_modules/.bin/gulp
2.deploy to test server,run
gulp deploytest
Please update your ftp auth name and password in ".ftppass".View the page on test server http://office.mozat.com:8083/PROJECTNAME/.This command require openssl.For windows,you might needd to add openssl path to classpath.
3.deploy to offical server,run
gulp deploy
View the page on offical server http://m.deja.me/PROJECTNAME/.This command require rsync.For windows,unzip /tools/rsync.zip to a local path and add the path to classpath.
4.run this command to copy source images to project's resources/images/
path,then generate scss/_sprites.csss
and resources/images/sprites.png
for sourceSprites in package.json
.
gulp copy
5.run this command to start jshint.
gulp jshint
6.run this command to start browserSync,Change browserSync options in package.json
.
gulp serve
7.run this command to start pagespeed,Change pagespeed options in package.json
.
gulp pagespeed
The structure is modular design,follow the DOOR-KEY rule you only take minutes to understand it:
/src/app/App.js
,and the KEY is require
,see webpack and commonjs/scss/styles.scss
,and the KEY is @import
,see SASS/html/debug/index.html
,and the KEY is @@include
,see gulp-file-includeRandom git commit message
git commit -m"`curl -s http://whatthecommit.com/index.txt`"
常规函数只会返回一个单一值(或者不返回任何值)。 而 Generator 可以按需一个接一个地返回(“yield”)多个值。它们可与 iterable 完美配合使用,从而可以轻松地创建数据流。 Generator 函数 要创建一个 generator,我们需要一个特殊的语法结构:function*,即所谓的 “generator function”。 它看起来像这样: function* gene
generator(生成器)是ES6标准引入的新的数据类型。一个generator看上去像一个函数,但可以返回多次。 ES6定义generator标准的哥们借鉴了Python的generator的概念和语法,如果你对Python的generator很熟悉,那么ES6的generator就是小菜一碟了。如果你对Python还不熟,赶快恶补Python教程!。 我们先复习函数的概念。一个函数是一段完整
Express' application generator. Installation $ npm install -g express-generator Quick Start The quickest way to get started with express is to utilize the executable express(1) to generate an applicat
Generator并发 正如我们在第一章和本章早先讨论过的,另个同时运行的“进程”可以协作地穿插它们的操作,而且许多时候这可以产生非常强大的异步表达式。 坦白地说,我们前面关于多个generator并发穿插的例子,展示了这真的容易让人糊涂。但我们也受到了启发,有些地方这种能力十分有用。 回想我们在第一章中看过的场景,两个不同但同时的Ajax应答处理需要互相协调,来确保数据通信不是竟合状态。我们这样
Generator 委托 在上一节中,我们展示了从generator内部调用普通函数,和它如何作为一种有用的技术来将实现细节(比如异步Promise流程)抽象出去。但是为这样的任务使用普通函数的缺陷是,它必须按照普通函数的规则行动,也就是说它不能像generator那样用yield来暂停自己。 在你身上可能发生这样的事情:你可能会试着使用我们的run(..)帮助函数,从一个generator中调用
Install npm install --save-dev @babel/generator Usage import {parse} from '@babel/parser'; import generate from '@babel/generator'; const code = 'class Example {}'; const ast = parse(code); const o