以下设置使jQuery
插件mixitup
完美运行。
"browser": {
"mixitup": "./app/bower_components/mixitup/src/jquery.mixitup.js",
"jquerymustache": "./app/bower_components/jquery-Mustache/src/jquery.mustache.js"
},
"browserify": {
"transform": [
"browserify-shim"
]
},
"browserify-shim": {
"mixitup": {
"exports": "mixitup",
"depends": [
"jquery:jQuery"
]
},
"jquerymustache": {
"exports": "Jquerymustache",
"depends": [
"jquery:jQuery",
"mustache:mustache"
]
}
},
但是,当我尝试对 应用相同的约定时jquery-Mustache
,我无法获取我的模板:
"browser": {
"jquerymustache": "./app/bower_components/jquery-Mustache/src/jquery.mustache.js"
}
和
"jquerymustache": {
"exports": "Jquerymustache",
"depends": [
"jquery:jQuery",
"mustache:mustache"
]
}
我没有从终端收到错误(这将证明package.json
设置是犹太洁食的),但我确实从控制台收到了这个错误:
这表明了这一点:
这是我的 app.js 文件,感觉这是最相关的信息:
var $ = jQuery = require('jquery');
var mixitup = require('mixitup');
var Jquerymustache = require('jquerymustache');
var mustache = require('mustache');
以及获取模板的函数。
function templateLoader(e) {
var doc = document,
event = EventUtility.getEvent(e),
target = EventUtility.getTarget(event);
$.Mustache.options.warnOnMissingTemplates = true;
$.Mustache.load('templates/index.html')
.fail(function() {
$('#overlay').append('Failed to load templates from <code>templates.htm</code>');
})
.done(function() {
var output = $('#overlay');
$('body').mustache('templateID');
});
}
以及文件路径的好衡量,以证明函数中的路径是正确的: