Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带gulp的rendr把手_Gulp_Handlebars.js_Rendr - Fatal编程技术网

带gulp的rendr把手

带gulp的rendr把手,gulp,handlebars.js,rendr,Gulp,Handlebars.js,Rendr,我试图使用gulp作为我的rendr应用程序的编译器,但我遇到了 500 TypeError: template is not a function at module.exports.Backbone.View.extend.getInnerHtml (/home/longjeongs/thinksquareio.github.io/node_modules/rendr/shared/base/view.js:191:12) at module.exports.Backbone.V

我试图使用gulp作为我的rendr应用程序的编译器,但我遇到了

500 TypeError: template is not a function
   at module.exports.Backbone.View.extend.getInnerHtml (/home/longjeongs/thinksquareio.github.io/node_modules/rendr/shared/base/view.js:191:12)
   at module.exports.Backbone.View.extend.getHtml (/home/longjeongs/thinksquareio.github.io/node_modules/rendr/shared/base/view.js:198:21)
   at ViewEngine.getViewHtml (/home/longjeongs/thinksquareio.github.io/node_modules/rendr/server/viewEngine.js:75:15)
   at ViewEngine.render (/home/longjeongs/thinksquareio.github.io/node_modules/rendr/server/viewEngine.js:22:16)
   at View.render (/home/longjeongs/thinksquareio.github.io/node_modules/express/lib/view.js:126:8)
   at tryRender (/home/longjeongs/thinksquareio.github.io/node_modules/express/lib/application.js:639:10)
   at EventEmitter.render (/home/longjeongs/thinksquareio.github.io/node_modules/express/lib/application.js:591:3)
   at ServerResponse.render (/home/longjeongs/thinksquareio.github.io/node_modules/express/lib/response.js:961:7)
   at /home/longjeongs/thinksquareio.github.io/node_modules/rendr/server/router.js:87:11
   at Object.module.exports.create (/home/longjeongs/thinksquareio.github.io/app/controllers/users_controller.js:5:5)
我在任何地方都找不到使用gulp编译
rendr Handlebar
Handlebar
的示例,我想我会尝试在这里获得一些帮助

我在别处读到,这是由不同的编译器手柄和客户端手柄版本引起的,但我相信我安装了正确的手柄。我已经安装了这些依赖项

│ ├─┬ handlebars@2.0.0
├─┬ gulp-handlebars@3.0.1
├─┬ handlebars@2.0.0
├── rendr-handlebars@2.0.1
我的
compiledTempaltes.js
文件显示了
“编译器”:[6,”>=2.0.0-beta.1”
。我对车把的吞咽任务如下:

gulp.task('handlebars:compile', function () {

    return gulp.src('./app/templates/**/[!__]*.hbs')
        .pipe(plumber())
        .pipe(handlebars({ wrapped : true, handlebars: require('handlebars') }))
        .pipe(wrap('templates["<%= file.relative.replace(/\\\\/g, "/").replace(/.js$/, "") %>"] = <%= file.contents %>;\n'))
        .pipe(concat('compiledTemplates.js'))
        .pipe(wrap('module.exports = function(Handlebars){\ntemplates = {};\n<%= contents %>\nreturn templates \n};'))
        .pipe(gulp.dest('app/templates/'));
});
gulp.task('handlebar:compile',function(){
return gulp.src('./app/templates/**/[!\uuu]*.hbs')
.管子(管道工())
.pipe(把手({wrapped:true,handlebar:require('handlebar')}))
.pipe(换行('templates[“”]=;\n'))
.pipe(concat('compiledTemplates.js'))
.pipe(wrap('module.exports=function(handlebar){\n模板={};\n\n返回模板\n};'))
.pipe(gulp.dest('app/templates/');
});

我已经尝试过安装不同版本的车把、rendr车把和gulp车把,但运气不好,任何帮助都将不胜感激。

我在rendr项目中使用gulp。。。我制作了一个示例应用程序,您可以查看


我在本地修复了浏览器同步的一些问题,因此如果复制整个gulp设置,该部分将无法工作。我会将我的编辑推送到github repo。

如果能将此添加到Rendr示例中会很好。不过,为了投票结果,我不会费心修改它@斯摩哈德杰