在velocity模板中包含js或css文件
我尝试在 .vm 文件中添加一个 js 文件或 css 文件,但
<script src='/templates/jquery-1.6.2.js>
没有成功。 但是当我尝试添加如下所示的内容时,它起作用了
<script type="text/javascript">
#include( "jquery-1.6.2.js" )
</script>
但是问题出在浏览器中,如果查看源代码,甚至 jquery-1.6.2.js 代码也会出现。它不会隐藏 js 代码。是否有其他方法可以在速度模板中添加 js 或 css 文件?
I tried to add a js file or css file as i mentioned below in the .vm file
<script src='/templates/jquery-1.6.2.js>
it didn't work.
But when i tried adding as given below it worked
<script type="text/javascript">
#include( "jquery-1.6.2.js" )
</script>
But the issue is in the browser if do view source even the jquery-1.6.2.js code also appears.It doesnot hide the js code. Is there any alternate way to add the js or css file in velocity template ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人遇到这个问题,有一种简单的方法可以在 Velocity 模板中包含 CSS 样式。我需要向 .vm 文件添加一些覆盖,并在
中放置一个具有适当规则的
标记。我最初在
标记内有
In case someone comes across this question, there is a straightforward way to include CSS styles in a Velocity template. I had a need to add some overrides to a .vm file, and putting a
<style>
tag with the appropriate rules inside<body>
worked. I initially had the<style>
inside the<head>
tag but that wasn't being picked up by the parser for some reason. It looked fine in IE 8, FF 3.6, and Chrome.