-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
按照官网快速开始教程遇到错误,模板渲染问题 #643
Comments
配置写错了,你这样写 export.view 是不生效的。
bendise <[email protected]>于2017年3月25日 周六10:46写道:
…
- *Node Version*:6.9.2
- *Egg Version*:1.0.0
- *Plugin Name*:egg-view-nunjucks
- *Plugin Version*:2.0.0
- *Platform*:mac os
按照官方快速入门教程执行到模板渲染部分时,出现错误:Can't find viewEngine for
/Users/xxxi/egg-example/app/view/news/list.tpl
config.default.js
’use strict';
module.exports = appInfo => {
const config = {};
// should change to your own
config.keys = appInfo.name + '_1490105333960_7282';
return config;
};
exports.view = {
defaultViewEngine: 'nunjucks',mapping: {'.tpl': 'nunjucks'},};`
plugin.js
’use strict’;
// had enabled by egg
// exports.static = true;
exports.nunjucks = {
enable: true,
package: 'egg-view-nunjucks'
};
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#643>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAWA1euhGXw1WIuGPboR0CpPGpdS-5Czks5rpIAVgaJpZM4Mo8DT>
.
|
@bendise 可以看下 markdown 的语法,下次贴代码的时候,格式化下。 从你的代码来看,是这段的问题, 建议你看下 modules.exports 和 exports 的入门知识。 https://cnodejs.org/topic/54e67b70629934692ea99f91 module.exports = appInfo => {
const config = {};
// ...
return config;
}
exports.view = {
defaultViewEngine: 'nunjucks',
mapping: {'.tpl': 'nunjucks'},
} 应该改为: module.exports = appInfo => {
const config = {};
// ...
config.view = {
// ...
}
return config;
} |
@atian25 非常感谢耐心解答,已经解决了这个问题。 |
官网还没改过来,0.0 |
@alphaobj 改啥? |
@alphaobj 官网的没问题。lz问题在于同时使用了 |
js 太灵活了,如果没有一个开发约定那么对于复制粘贴的新手来说很容易犯错。 |
TS 的今晚可以发布了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
按照官方快速入门教程执行到模板渲染部分时,出现错误:
Can't find viewEngine for /Users/xxxi/egg-example/app/view/news/list.tpl
The text was updated successfully, but these errors were encountered: