Closed khomyakov42 closed 11 years ago
You can resolve this issue, modify end of file extra/coffee-script.js:
// "function" == typeof define && define.amd ? define(function() {
// return CoffeeScript
// }) : root.CoffeeScript = CoffeeScript
root.CoffeeScript = CoffeeScript
This modification force assign to window object - CoffeeScript, that necessary for ECT
Ты можешь пофиксить это, изменив конец файла extra/coffee-script.js следующим образом:
// "function" == typeof define && define.amd ? define(function() {
// return CoffeeScript
// }) : root.CoffeeScript = CoffeeScript
root.CoffeeScript = CoffeeScript
Данное изменение в любом случае даст присвоить объекту window - CoffeeScript, что нужно для нормальной работы ECT
Hey, it's issue not resolved. And trick with coffee not right. Ect should natively support this situation.
Рано закрывать эту проблему. Трюк с coffee - временное решение. Ect должен сам разруливать эту ситуацию с requirejs и coffee.
Add pull request #37
But this potentially can raise error, if *.ect template will start load before coffee-script loaded.
So you can tune your require.config
for avoid this situation:
require.config.paths
- "ect": "<relative path to ect>"
require.config.paths
- "coffee-script": "<relative path to coffee-script>"
require.config.shim
- "ect" : {"deps": ["coffee-script"]}
This guarantees, that coffee-script will load before ect
Добавил pull request #37
Но теоритечески может возникнуть ошибка, если *.ect шаблоны начнут грузиться до того, как coffee-script был загружен. Но вы можете поправить ваш require.config
для избежания этой ситуации.
require.config.paths
- "ect": "<относительный путь до ect>"
require.config.paths
- "coffee-script": "<относительный путь до coffee-script>"
require.config.shim
- "ect" : {"deps": ["coffee-script"]}
Это гарантирует, что coffee-script будет загружен до ect
Now ECT defined lowercase ect
RequireJS module that depends on lowercase coffee-script
module.
'libs/coffee-script': { exports: 'CoffeeScript', init: ()-> return window.CoffeeScript = this }, 'libs/ect': { deps: ['libs/coffee-script'], init: () -> return ECT(root: '/assets/templates', ext: '.ect') },
Ошибка Uncaught TypeError: Cannot call method 'compile' of undefined in /assets/templates/index.ect