私は、Laravel 5で開発された既に構築されたシステムで作業しています.htmlに関しては、以前の開発者はBackboneを使用していましたが、レイアウトには2つのJSファイルしか存在しません。 1つのファイルでは、すべての基本的な必須jsファイルとすべてのJSファイルのバックボーンを結び付けます。彼はこのファイルをadmin.js
と命名した。彼は別のファイルを使い、すべてのhtmlテンプレートをあらかじめコンパイルされたハンドルバーテンプレートとして使用していて、それをadmin_template.js
と名づけました。彼はシステム全体でこれらの2つのjsファイルのみを使用します。私はサーバーコードにアクセスできますが、彼がどのビルドシステムを使用したかを示すファイルはありません。サーバーにはpackage.json
はありません。私は彼が自分のローカルでこれらのものを使用していただろうと思うし、これらのものをリポジトリまたはサーバーにプッシュしたことはありません。Gruntハンドルバープリコンパイラテンプレート
深く掘削することによって、私は彼がGrunt
を使用したことを知るようになりました。私は彼がすでに生成したようにadmin.js
ファイルを生成するように管理しています。テンプレートの場合、彼はJST
を使用しています。私は検索して1つを見つけたgrunt-contrib-handlebars。私はテンプレートファイルを生成することができましたが、それは既存のファイルと100パーセント一致していません。例えば、ここでは、既存のファイル
this["JST"] = this["JST"] || {};
this["JST"]["admin/Modules/Base/Templates/InModalMessageTemplate.html"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
var buffer = "", stack1, helper, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
function program1(depth0,data) {
var buffer = "", stack1, helper;
buffer += "\n<div id=\"inModalMessageWrap\" class=\"bs-callout bs-callout-danger ";
if (helper = helpers.type) { stack1 = helper.call(depth0, {hash:{},data:data}); }
else { helper = (depth0 && depth0.type); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
buffer += escapeExpression(stack1)
+ "\">\n";
return buffer;
}
の内容であり、同じセクションのために、私のファイルをチェックし
this["JST"] = this["JST"] || {};
this["JST"]["./public/assets/js/admin/Modules/Base/Templates/InModalMessageTemplate.html"] = Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
var helper;
return "<div id=\"inModalMessageWrap\" class=\"bs-callout bs-callout-danger "
+ container.escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"type","hash":{},"data":data}) : helper)))
+ "\">\n";
},"3":function(container,depth0,helpers,partials,data) {
var helper;
return "<div id=\"inModalMessageWrap\" class=\"bs-callout bs-callout-success "
+ container.escapeExpression(((helper = (helper = helpers.type || (depth0 != null ? depth0.type : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"type","hash":{},"data":data}) : helper)))
+ "\">\n";
}
旧1をチェックし、いくつかのfunction program1(depth0,data) {
を持っていますが、私の生成1でそのありません。旧1では、我々はthis.compilerInfo = [4,'>= 1.0.0'];
ようcompilerInfoを持っており、私の中で、それは私が生成されたファイルでプロジェクトを実行しようとすると、それは{"compiler":[7,">= 4.0.0"]
のようであるいくつかの場所でそれをいくつかの場所で行方不明とされた1を生成し、それが
`TypeError: templateSpec.call is not a function`
を語ります
このエラーを検索しましたが、ハンドルバーのバージョンに関する問題です。私は上記のバージョンをインストールしましたが、このエラーはどこにもありません。これは私のgruntfileが
module.exports = function(grunt) {
var libFiles = [
'./public/assets/js/admin/Modules/**/*.js'
];
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
stripBanners: true,
banner: '/*! Compiled on: <%= grunt.template.today("mm-dd-yyyy") %> */' + '\n\n',
separator: "\n",
process: function (src, filepath) {
return '// Source: '+filepath+'\n\n' + src+'\n'
}
},
dist: {
src: libFiles,
dest: './public/assets/js/compiled/admin.js',
},
},
handlebars: {
compile: {
options: {
namespace: 'JST'
},
files: {
'./public/assets/js/compiled/my_template.js': ['./public/assets/js/admin/Modules/**/*.html']
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-handlebars');
// Default task(s).
grunt.registerTask('default', ['concat', 'handlebars']);
};
すべてのボディは、私はこの問題を解決することができますし、プリコンパイルされたハンドルバーテンプレートのためにそこに既にある正確なファイルを生成することができますどのように知らせることができますどのように見えるかですか?物事の