Edgewall Software

Opened 14 years ago

Closed 14 years ago

#4430 closed task (invalid)

Plugins with CSS and chrome

Reported by: jc@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10.3
Severity: normal Keywords: plugins css htdocs
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


Plugins that comes with their own templates and css have a minor problem. The templates can be dropped into the site-templates folder. But the CSS cannot be dropped into the "static" folder you can reference in the trac.ini

htdocs_location = /layout

Would be great if the static resources of plugins can also be found in that location.

To solve that without modifying the trac code I added a small RewriteRule to the Apache. So all plugin static resources are under /layout/plugin/..

        RewriteCond     %{REQUEST_URI}  ^/(\w+/)?chrome/(.*)
        RewriteCond     /path/to/webservers/htdocs/layout/%2  -f
        RewriteRule     ^(.*)   /layout/%2      [PT]

Attachments (0)

Change History (1)

comment:1 by simon-code@…, 14 years ago

Resolution: invalid
Status: newclosed

Actually, in addition to the 'common' and 'site' names in the path, a htdocs folder inside your plugin can also be referenced directly by. That means you have the following options:

  • …/projectname/chrome/site/myown.css # From project htdocs
  • …/projectname/chrome/common/aglobal.css # From global htdocs
  • …/projectname/chrome/myplugin/myplugin.css # From your plugin

The advantage is of course that your plugin will be self-contained - no need to move static resources out, and setup tools will keep it all together as a nice package. This also works for templates, and there is no need to move them either - any resource can be kept inside the plugin.

The topics are covered in the EggCookingTutorial tutorial over at Trac-Hacks.

As your ticket provides an alternative solution to something that is already well supported + is for one platform only (Apache), I am closing this ticket as invalid. Please reopen if I have misunderstood your intentions. Also, for future you may want to consider using the MailingList to post questions and general information.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.