Difference between revisions of "Routing and Template Cookbook: Including resources"
From Dreamwidth Notes
Foxfirefey (Talk | contribs) (Created page with " = Templates = == Specifying needed CSS/JS files == <syntaxhighlight lang="html4strict"> [%- CALL dw.set_active_resource_group( 'jquery' ) -%] [%- dw.need_res( 'stc/kitten.c...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
<syntaxhighlight lang="html4strict"> | <syntaxhighlight lang="html4strict"> | ||
− | [%- CALL dw. | + | [%- CALL dw.active_resource_group( 'jquery' ) -%] |
[%- dw.need_res( 'stc/kitten.css' ) -%] | [%- dw.need_res( 'stc/kitten.css' ) -%] | ||
[%- dw.need_res( 'js/ponies.js' ) -%] | [%- dw.need_res( 'js/ponies.js' ) -%] | ||
− | [%- dw.need_res( | + | [%- dw.need_res( { group => 'jquery' }, 'js/sparkle.js' ) -%] |
</syntaxhighlight> | </syntaxhighlight> | ||
Note: ignore the first and last if your page doesn't use jQuery. | Note: ignore the first and last if your page doesn't use jQuery. | ||
− | For CSS, remember to use the [http://www.dreamwidth.org/dev/ | + | For CSS, remember to use the [http://www.dreamwidth.org/dev/style-guide standardized classes] as much as possible. |
== Adding code to the head == | == Adding code to the head == |
Latest revision as of 18:24, 24 December 2016
Templates
Specifying needed CSS/JS files
[%- CALL dw.active_resource_group( 'jquery' ) -%] [%- dw.need_res( 'stc/kitten.css' ) -%] [%- dw.need_res( 'js/ponies.js' ) -%] [%- dw.need_res( { group => 'jquery' }, 'js/sparkle.js' ) -%]
Note: ignore the first and last if your page doesn't use jQuery.
For CSS, remember to use the standardized classes as much as possible.
Adding code to the head
Use this section code to add things to the head of the page.
[% sections.head = BLOCK %] <style type="text/css"> dt { font-size: bigger; font-weight: bold; margin-bottom: .2em; } dd { margin-bottom: 1em; } </style> [% END # sections.head %]