[[PageOutline(2-5,Contents,pullout)]] = Add Static Resources to wiki pages == Description 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'''. {{{#!ini [static_resources] 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: {{{#!ini [static_resources] /(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 [report:9?COMPONENT=AddStaticResourcesPlugin here]. If you have any issues, create a [/newticket?component=AddStaticResourcesPlugin new ticket]. [[TicketQuery(component=AddStaticResourcesPlugin&group=type,format=progress)]] == Download Download the zipped source from [export:addstaticresourcesplugin here]. == Source You can check out AddStaticResourcesPlugin from [/svn/addstaticresourcesplugin here] using Subversion, or [source:addstaticresourcesplugin browse the source] with Trac. Also note that there are [#7334 case sensitive regex patches]. == Installation 1. Insert your static files into the 'addstaticresourcesplugin/htdocs' folder of the plugin before installation. 1. Install the plugin either for a single project or globally. See the details on how to install a Trac plugin at [trac:TracPlugins]. 1. Enable the plugin in your `trac.ini` file: {{{#!ini [components] addstaticresourcesplugin.* = enabled }}} Alternatively, this can be enabled in the Web Admin section of the website as well. 1. Reload/restart your HTTPD / other webserver / Tracd. == Recent Changes [[ChangeLog(addstaticresourcesplugin, 3)]] == Author/Contributors '''Author:''' [wiki:bobbysmith007] [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''