开发者

Including a js or css file in velocity template

开发者 https://www.devze.com 2023-04-08 16:20 出处:网络
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>

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 al开发者_如何转开发so appears.It doesnot hide the js code. Is there any alternate way to add the js or css file in velocity template ??


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号