标签:
//新 view gulp.task("new_view",function(name,distName){ return gulp.src(‘templates/page.handlebars‘)//取源文件 .pipe(template({name: name?name:"new"}))//name参数是否有值 .pipe(rename({ basename:name })) .pipe(gulp.dest(‘jade/views‘));//在views文件夹输出 }) //新 service gulp.task("new_service ",function(name,distName ){ return gulp.src(‘templates/service .js‘) .pipe(template({name: distName ?distName :"new"})) .pipe(rename({ basename:name })) .pipe(gulp.dest(‘js/‘+distName+‘/‘));//在distName 文件夹输出 }) //新 controller gulp.task("new_controller ",function(name,distName ){ return gulp.src(‘templates/controller .js‘) .pipe(template({name: name?name:"new"})) .pipe(rename({ basename:name })) .pipe(gulp.dest(‘js/‘+distName+‘/‘));//在distName 文件夹输出 }) //gulp.task("new_less",function(name){ // return gulp.src(‘templates/style.less‘) // .pipe(template({name: name?name:"new"})) // .pipe(rename({ // basename:name // })) // .pipe(gulp.dest(‘src/less‘)); //}) gulp.task("inject_routes",function(name){ return gulp.src("js/common/routes.config.js") .pipe(replace("//more", ‘ .state(getState(),{\nurl:,\ntitle:,\ntemplateUrl:helper.basepath(),\nresolve: helper.resolveFor( ),\nconf : { login : true, level : [1, 2, 3]}, })\n //more ‘)) // .pipe(replace("//newRouter", ‘//newRouter\napp.use("/‘+name+‘", router_‘+name+‘);‘)) .pipe(gulp.dest("js/common/routes.config.js ")) }) gulp.task(‘new‘,function (name,controller,distName) { if(router) // return runsequence([‘new_view‘,"new_less","new_router","inject_app"]); return runsequence([‘new_view‘,"new_controller ","inject_routes "]); else return runsequence([‘new_view‘]); // return runsequence([‘new_view‘,"new_less"]); })
标签:
原文地址:http://www.cnblogs.com/xd1024/p/5906668.html