Edgewall Software

Ticket #4430 (closed task: invalid)

Opened 2 years ago

Last modified 2 years ago

Plugins with CSS and chrome

Reported by: jc@… Owned by: jonas
Priority: normal Milestone:
Component: general Version: 0.10.3
Severity: normal Keywords: plugins css htdocs
Cc:

Description

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

[trac]
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/..

        # REWRITE ANY CHROME REFERENCE TO A LOCAL FILE IF EXISTS
        RewriteCond     %{REQUEST_URI}  ^/(\w+/)?chrome/(.*)
        RewriteCond     /path/to/webservers/htdocs/layout/%2  -f
        RewriteRule     ^(.*)   /layout/%2      [PT]

Attachments

Change History

Changed 2 years ago by simon-code@…

  • status changed from new to closed
  • resolution set to invalid

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.

Add/Change #4430 (Plugins with CSS and chrome)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.