Skip to content
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

velocity模板可以是.html后缀的吗 #7

Open
hqqxxf opened this issue Jul 21, 2016 · 9 comments
Open

velocity模板可以是.html后缀的吗 #7

hqqxxf opened this issue Jul 21, 2016 · 9 comments

Comments

@hqqxxf
Copy link

hqqxxf commented Jul 21, 2016

fis.match('*.html', {
parser: fis.plugin('vm')
});
用了fis3-parser-vm
但报错了
[ERROR] parser.vm: Call undefined macro. [E:/mygithub/jello-fis-practice/page/page.html]
然后我换成fis3-parser-velocity,数据绑定不了,请大神指示

@2betop
Copy link
Contributor

2betop commented Jul 21, 2016

jello 里面不是用的他,而是

fis.match('*.html', {
    preprocessor: fis.plugin('extlang', {
        type: 'velocity'
    })
})

@hqqxxf
Copy link
Author

hqqxxf commented Jul 21, 2016

可是我用了之后报错:[ERROR] preprocessor.extlang: Cannot read property 'unshift' of undefined [E:/jello-fis-practice/page/page.html]

@2betop
Copy link
Contributor

2betop commented Jul 21, 2016

编译的时候带上 --verbose,然后把详细的报错信息贴出来。

@hqqxxf
Copy link
Author

hqqxxf commented Jul 21, 2016

58@58-PC MINGW32 /e/mygithub/jello-fis-practice
$ fis3 release --verbose

[DEBUG] 12:33:55.039 Resolved module jello to C:\Users\58\AppData\Ro aming\npm\node_modules\fis3-jello\index.js

[INFO] Currently running fis3 (C:\Users\58\AppData\Roaming\npm\node_ modules.fis3_npminstall\fis3\3.4.17\fis3)

[DEBUG] 12:33:55.059 Resolved module command-release to C:\Users\58\ AppData\Roaming\npm\node_modules.fis3_npminstall\fis3\3.4.17\fis3\no de_modules\fis3-command-release\index.js

[DEBUG] 12:33:55.255 revert cache

[DEBUG] 12:33:55.256 cache file exists

[DEBUG] 12:33:55.257 cache info read

[DEBUG] 12:33:55.257 cache is expired

δ 5ms

Ω
[DEBUG] 12:33:55.301 Resolved module hook-components to C:\Users\58\ AppData\Roaming\npm\node_modules.fis3_npminstall\fis3\3.4.17\fis3\no de_modules\fis3-hook-components\index.js

[DEBUG] 12:33:55.304 Resolved module hook-commonjs to C:\Users\58\Ap pData\Roaming\npm\node_modules\fis3-jello\node_modules\fis3-hook-comm onjs\index.js

[DEBUG] 12:33:55.465 compile [E:/mygithub/jello-fis-practice/page/in dex.vm] start

[DEBUG] 12:33:55.466 revert cache

[DEBUG] 12:33:55.467 cache is expired

[DEBUG] 12:33:55.471 Resolved module preprocessor-extlang to C:\User s\58\AppData\Roaming\npm\node_modules\fis3-jello\node_modules\fis3-pr eprocessor-extlang\index.js

[DEBUG] 12:33:55.482 pipe [preprocessor.extlang] start

[DEBUG] 12:33:55.488 pipe [preprocessor.extlang] end

[DEBUG] 12:33:55.488 pipe [standard.builtin] start

[DEBUG] 12:33:55.488 builtin standard for [E:/mygithub/jello-fis-pra ctice/page/index.vm] start

[DEBUG] 12:33:55.510 builtin standard for [E:/mygithub/jello-fis-pra ctice/page/index.vm] end

[DEBUG] 12:33:55.510 pipe [standard.builtin] end

[DEBUG] 12:33:55.510 postStandard start

[DEBUG] 12:33:55.518 postStandard end

[DEBUG] 12:33:55.518 Save cache [/page/index.vm] start

[DEBUG] 12:33:55.522 Save cache [/page/index.vm] end

[DEBUG] 12:33:55.522 compile [E:/mygithub/jello-fis-practice/page/in dex.vm] end

[DEBUG] 12:33:55.522 E:/mygithub/jello-fis-practice/page/index.vm

[DEBUG] 12:33:55.526 compile [E:/mygithub/jello-fis-practice/page/pa ge.html] start

[DEBUG] 12:33:55.527 revert cache

[DEBUG] 12:33:55.527 cache is expired

[DEBUG] 12:33:55.528 pipe [preprocessor.extlang] start

[DEBUG] 12:33:55.530 pipe [preprocessor.extlang] fail

[ERROR] preprocessor.extlang: Cannot read property 'unshift' of unde fined [E:/mygithub/jello-fis-practice/page/page.html]

[DEBUG] 12:33:55.532 TypeError: preprocessor.extlang: Cannot read pr operty 'unshift' of undefined [E:/mygithub/jello-fis-practice/page/pa ge.html]
at makeLevel (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:77:15 )
at makeLevel (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:75:18 )
at parse (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-jello \node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:37:13)
at transform (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lang\velocity.js:35:14)
at Object.module.exports [as velocity](C:Users58AppDataRoami ngnpmnode_modulesfis3-jellonode_modulesfis3-preprocessor-extlang langvelocity.js:6:13)
at module.exports (C:\Users\58\AppData\Roaming\npm\node_modules\f is3-jello\node_modules\fis3-preprocessor-extlang\index.js:27:27)
at callback (C:\Users\58\AppData\Roaming\npm\node_modules.fis3_n pminstall\fis3\3.4.17\fis3\lib\compile.js:661:22)
at C:\Users\58\AppData\Roaming\npm\node_modules.fis3_npminstall\ fis3\3.4.17\fis3\lib\compile.js:721:9
at Array.forEach (native)
at pipe (C:\Users\58\AppData\Roaming\npm\node_modules.fis3_npmin stall\fis3\3.4.17\fis3\lib\compile.js:692:16)

C:\Users\58\AppData\Roaming\npm\node_modules.fis3_npminstall\fis3-co mmand-release\1.3.8\fis3-command-release\lib\release.js:86
throw e;
^

TypeError: preprocessor.extlang: Cannot read property 'unshift' of un defined [E:/mygithub/jello-fis-practice/page/page.html]
at makeLevel (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:77:15 )
at makeLevel (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:75:18 )
at parse (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-jello \node_modules\fis3-preprocessor-extlang\lib\parser\parse.js:37:13)
at transform (C:\Users\58\AppData\Roaming\npm\node_modules\fis3-j ello\node_modules\fis3-preprocessor-extlang\lang\velocity.js:35:14)
at Object.module.exports [as velocity](C:Users58AppDataRoami ngnpmnode_modulesfis3-jellonode_modulesfis3-preprocessor-extlang langvelocity.js:6:13)
at module.exports (C:\Users\58\AppData\Roaming\npm\node_modules\f is3-jello\node_modules\fis3-preprocessor-extlang\index.js:27:27)
at callback (C:\Users\58\AppData\Roaming\npm\node_modules.fis3_n pminstall\fis3\3.4.17\fis3\lib\compile.js:661:22)
at C:\Users\58\AppData\Roaming\npm\node_modules.fis3_npminstall\ fis3\3.4.17\fis3\lib\compile.js:721:9
at Array.forEach (native)
at pipe (C:\Users\58\AppData\Roaming\npm\node_modules.fis3_npmin stall\fis3\3.4.17\fis3\lib\compile.js:692:16)

@hqqxxf
Copy link
Author

hqqxxf commented Jul 21, 2016

用jello-demo试了一下,发现将.vm换成.html再配置上
fis.match('*.html', {
preprocessor: fis.plugin('extlang', {
type: 'velocity'
})
});
没有报错,但无法生效,页面不能编译为html

@2betop
Copy link
Contributor

2betop commented Jul 21, 2016

不能生效是啥意思?什么表现

@hqqxxf
Copy link
Author

hqqxxf commented Jul 21, 2016

数据绑定不了,页面加载只有部分html标签,其他vm都加载不了

@2betop
Copy link
Contributor

2betop commented Jul 21, 2016

那当然啦,jello 预览环境只认 vm 文件,你是为何要用 html 后缀呢?如果功能都要求一样为何不直接一个 vm 后缀,如果只是因为后端限制,大不了产出给后端的时候变成 html 后缀。

@hqqxxf
Copy link
Author

hqqxxf commented Jul 21, 2016

好吧,谢谢你,终于明白了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants