Uniform Frontend Architecture: An uniform usage of gulp.
- Different applications have different configurations.
- Each applications needs to deploy itself every time.
-
Check your npm registry config. To view your config, please run command
npm config list. It will return:; cli configs user-agent = "npm/2.14.4 node/v4.1.1 darwin x64" ; userconfig /Users/quentin/.npmrc registry = "http://registry.npm.taobao.org/" ; builtin config undefined prefix = "/usr/local" -
Suggestion: set npm config
registrytohttp://registry.npm.taobao.org/.npm config set registry http://registry.npm.taobao.org/
npm install
Command format: gulp-ufa $app $task --$env --dir $dir
// run "default" task for app-site in production and dir is 'public/dist/'
gulp-ufa app-site
// run "default" task for app-web in production and dir is 'public/dist/'
gulp-ufa app-web -p --dir public/dist
// run "scripts" task for app-boss in production and dir is 'public/dist/'
gulp-ufa app-boss scripts -p --dir public/dist
Create one new task file under tasks/ folder, and content would look like as following:
function task(cb, params) {
//TODO::task content
}
module.exports = task;
Attributes in params parameter:
appstring.
E.g.: app-site
taskstring.
E.g.: scripts
contextobject.
E.g.: {
}