[[PageOutline(2-5,Contents,pullout)]] = AddStaticResourcesPlugin = == Description == A plugin that maps static resources into urls 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 a regex that matches the 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'''. (There is a patch listed below to provide case sensitivity) {{{ #!ini [static_resources] url-regex = list_of_files.js, and_style.css }}} == Installation Help == 1. Insert your static files into the 'addstaticresourcesplugin/htdocs' folder of the plugin before install 1. Install the plugin (either for a single project, or globally). See the details on how to install a trac plugin at: [trac:TracPlugins] * '''No Really, GO READ [trac:TracPlugins]''' 1. Be sure that the plugin is enabled. Add "addstaticresourcesplugin.* = enabled" to trac.ini (in the [components] subheading). * Alternatively, this can be enabled in the Web Admin section of the website as well 1. Reload/restart your HTTPD / other webserver / Tracd. That's it. == Related Plugins == === TracTweakUiPlugin === This plugin is trying to accomplish much of what TracTweakUiPlugin is, however I had some goals that were not being met by TracTweakUiPlugin. * Simple, I want to simply map a url to a javascript/stylesheet that should be included. * Affect all tracs at once * I have many tracs so specifying this once in the shared conf 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. == Bugs/Feature Requests == Existing bugs and feature requests for AddStaticResourcesPlugin are [report:9?COMPONENT=AddStaticResourcesPlugin here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=AddStaticResourcesPlugin&owner=bobbysmith007 new ticket]. == Download & Source == '''The trac 11 branch seems to work fine in trac 12, if you experience any issues [http://trac-hacks.org/newticket?component=AddStaticResourcesPlugin&owner=bobbysmith007 please report them]''' Download the zipped source: * [download:addstaticresourcesplugin ZIP]. SVN: * [http://trac-hacks.org/svn/addstaticresourcesplugin SVN] or [source:addstaticresourcesplugin browse the source] with Trac. === Patches === * [http://trac-hacks.org/ticket/7334 Case Sensitive Regex] == Example == This will cause the helloworld alert message to appear on the ticket and newticket pages. {{{ #!ini [static_resources] /(new)?ticket = helloworld.js }}} == Recent Changes == [[ChangeLog(addstaticresourcesplugin, 3)]] == Author/Contributors == '''Author:''' [wiki:bobbysmith007] [[BR]] '''Maintainer:''' [wiki:bobbysmith007] [[BR]] '''Contributors:'''