[Trac] Concerning shared templates and stylesheets

29 views
Skip to first unread message

Itamar O

unread,
Jun 5, 2010, 2:08:30 PM6/5/10
to trac-users
Hi,

I want to have multiple environments with a shared stylesheet.
So I set the [inherit] templates_dir = ... and put my site.html there.
But I'm still confused as to where to put my shared style.css
and how to specify its location in the site.html.
The example in [1] uses ${href.chrome('site/style.css')},
but this refers to the env-specific htdocs, which is not what I need.

Any tips?
Thanks.

[1] http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance

Itamar.

Remy Blank

unread,
Jun 5, 2010, 4:06:38 PM6/5/10
to trac-...@googlegroups.com
Itamar O wrote:
> I want to have multiple environments with a shared stylesheet.
> So I set the [inherit] templates_dir = ... and put my site.html there.
> But I'm still confused as to where to put my shared style.css
> and how to specify its location in the site.html.
> The example in [1] uses ${href.chrome('site/style.css')},
> but this refers to the env-specific htdocs, which is not what I need.

You can create the stylesheet in a shared location, then add a symlink
to that file in the htdocs directory of each environment. The stylesheet
can then be referenced with the "site/" prefix. Not very elegant, but it
works. Of course, this is somewhat more difficult to achieve on Windows.

-- Remy

signature.asc

Itamar O

unread,
Jun 6, 2010, 12:03:17 AM6/6/10
to trac-...@googlegroups.com

I am on Windows.
How would I achieve this?
I assumed there would be some [inherit] htdocs_dir = ... that I missed.

Remy Blank

unread,
Jun 6, 2010, 7:13:22 AM6/6/10
to trac-...@googlegroups.com
Itamar O wrote:
> I am on Windows.
> How would I achieve this?

You can create symbolic links in Windows, subject to a few limitations:
use NTFS and IIRC it only really works starting from Vista. See the
following page for more info:

http://en.wikipedia.org/wiki/NTFS_symbolic_link

> I assumed there would be some [inherit] htdocs_dir = ... that I missed.

That could be useful, yes. And is probably very easy to do, by returning
an additional 'site' entry in Chrome.get_htdocs_dirs().

-- Remy

signature.asc

Noah Kantrowitz

unread,
Jun 6, 2010, 7:23:05 PM6/6/10
to trac-...@googlegroups.com

The better answer is to not use Trac and just put the shared CSS file up on a webserver somewhere and just reference that single URL in the site.html

--Noah

Remy Blank

unread,
Jun 7, 2010, 1:51:55 PM6/7/10
to trac-...@googlegroups.com
Noah Kantrowitz wrote:
> The better answer is to not use Trac and just put the shared CSS
> file up on a webserver somewhere and just reference that single
> URL in the site.html

Yes, that's a good idea, too ;-)

-- Remy

signature.asc

Itamar O

unread,
Jun 25, 2010, 7:06:01 AM6/25/10
to trac-...@googlegroups.com

Pretty easy indeed.
I have devised a patch and created http://trac.edgewall.org/ticket/9462 for it.

>
> -- Remy
>
>

Reply all
Reply to author
Forward
0 new messages