Changes between Version 3 and Version 4 of AddHeadersPlugin


Ignore:
Timestamp:
Nov 1, 2008, 2:18:35 PM (11 years ago)
Author:
Martin Scharrer
Comment:

Added more examples.

Legend:

Unmodified
Added
Removed
Modified
  • AddHeadersPlugin

    v3 v4  
    4343
    4444
    45 See also the [#Example example] below.
     45See also the [#Examples example] below.
    4646
    4747== Bugs/Feature Requests ==
     
    5959== Source ==
    6060
    61 You can check out AddHeadersPlugin from [http://trac-hacks.org/svn/addheadersplugin here] using Subversion, or [source:addheadersplugin browse the source] with Trac.
     61You can check out AddHeadersPlugin from [http://trac-hacks.org/svn/addheadersplugin/0.11 here] using Subversion, or [source:addheadersplugin/0.11 browse the source] with Trac.
    6262
    63 == Example ==
    64 The following example shows how to add files for a multi-style implementation:
     63== Examples ==
     64=== Multi-Style ===
     65The following example shows how to add files for a multi-style implementation, i.e. the user can select between different graphics styles:
    6566The !JavaScript file is located at `$TRAC_PROJECT_DIR/htdocs/js/multistyle.js` and all CSS files are located at `$TRAC_PROJECT_DIR/htdocs/css/`.
    6667A general style file '`common.css`' is included which holds all common style definition. The default style is in '`default.css`' and the alternative styles in '`theme1.css`' and '`theme2.css`'.
     
    9394}}}
    9495
     96=== Adding custom !JavaScript and CSS ===
     97The following example shows how to add some custom !JavaScript and CSS files. Here they all start with a common prefix. The JS files (abc_one.js,abc_two.js,abc_tree.js) are positioned in the `$TRAC_PROJECT_DIR/htdocs/js/` and the CSS files (style_print.css,style_screen.css) `$TRAC_PROJECT_DIR/htdocs/css/` directory.
     98
     99{{{
     100# in trac.ini
     101[addheaders]
     102default_style_base  = site/css/
     103default_script_base = site/js/
     104
     105add_scripts  = abc_one,abc_two,abc_tree
     106add_styles   = style_print,style_screen
     107}}}
     108
     109or, even shorter:
     110
     111{{{
     112# in trac.ini
     113[addheaders]
     114default_style_base  = site/css/abc_
     115default_script_base = site/js/style_
     116
     117add_scripts  = one,two,tree
     118add_styles   = print,screen
     119}}}
     120
     121=== Weird filenames ===
     122While the names given by `add_scripts` or `add_styles` is used to build the default filename, it becomes just an arbitrary string when the real filename is set explicitly using ''<name>''`.filename`.
     123This can be used when the real filename is quit weird, e.g. has commas included or is very long. Make sure to use an UTF-8 capable editor when adding non-ASCII letters.
     124{{{
     125# in trac.ini
     126[addheaders]
     127
     128add_scripts  = short
     129
     130short.filename = /site/somewhere/Very,weird,filename @;'öäßÖÄß¼€.js
     131# Also possible to change the MIME-type (default is 'text/javascript')
     132short.type     = text/something
     133
     134# Same for style files
     135# General link files must always be set explicitly
     136}}}
     137
    95138
    96139== Recent Changes ==