Add Static Resources to wiki pages


This is a plugin that maps static resources into web addresses of your choice. Thus if you wish to add a stylesheet or a JavaScript to an existing Trac page, you can specify in the trac.ini file a regular expression that matches the web addresses (URLs) of the pages and insert the resources. Just add your static resources to the plugins htdocs folder and install, then fill out the trac.ini configuration values to enable your static resources on each page you wish. Regular expressions are case insensitive by default.

url-regex = list_of_files.js, and_style.css

For example, this will cause the helloworld alert message to appear on the ticket and newticket pages:

/(new)?ticket = helloworld.js

There is also a patch listed below to provide case sensitivity.

Note: This plugin shares much functionality of TracTweakUiPlugin, however with the following additional goals:

  • Allows mapping a URL to a JavaScript or stylesheet that should be included.
  • Affects all Trac projects at once:
    • I have many Trac projects, so specifying this once in the shared configuration file is much nicer than once in each database.
    • Deployment of files should be simple and preferably in the egg we are already installing, rather than in a static location I need to keep track of and separately manage for each Trac project.

Bugs/Feature Requests

Existing bugs and feature requests for AddStaticResourcesPlugin are here.

If you have any issues, create a new ticket.


1 / 1


1 / 1


Download the zipped source from here.


You can check out AddStaticResourcesPlugin from here using Subversion, or browse the source with Trac.

Also note that there are case sensitive regex patches.


  1. Insert your static files into the 'addstaticresourcesplugin/htdocs' folder of the plugin before installation.
  2. Install the plugin either for a single project or globally. See the details on how to install a Trac plugin at TracPlugins.
  3. Enable the plugin in your trac.ini file:
    addstaticresourcesplugin.* = enabled
    Alternatively, this can be enabled in the Web Admin section of the website as well.
  4. Reload/restart your HTTPD / other webserver / Tracd.

Recent Changes

14167 by bobbysmith007 on 2014-09-12 20:24:12
Allow using absolute refrences to static-resources
13436 by bobbysmith007 on 2013-11-08 16:52:52
New version of addstaticresourcesplugin that interacts better with trac 1.0 and is a bit simpler
13435 by bobbysmith007 on 2013-11-08 16:38:12
initing 1.0 branch


Author: bobbysmith007
Maintainer: Russ Tyndall

Last modified 2 years ago Last modified on Mar 22, 2022, 6:47:13 PM