On Thu, Apr 19, 2012 at 1:19 AM, Vincent Catalano
<[email protected]> wrote:
> Each of my views has a separate template and each of these templates
> extends the base template. However, each of my views uses a different
> Javascript file. What is the best way to include different Javascript
> files for each page using Chameleon templates? Thanks for your help!
1) A lo-fi way of doing this is to put this in your base template
where you want your <script> tags to appear:
<more tal:omit-tag="" metal:define-slot="more-scripts"></more>
Then in your view's template, use something like:
<more tal:omit-tag="" metal:fill-slot="more-scripts">
<script src="myscript.js" type="text/javascript"></script>
</more>
2) Consider putting all your scripts into a single, compressed file.
If they aren't huge, there's the benefit of not sending a HTTP request
for each one of your scripts.
3) Use something like fanstatic for when things are more complex:
http://www.fanstatic.org http://pypi.python.org/pypi/pyramid_fanstatic
Daniel
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.