Flexible JavaScript inclusions for Trac

Description

This is a simple plugin that allows you to specify system-wide, per-project and/or external JavaScript files to be included in your Trac pages.

Once installed, add the following section to your trac.ini:

[flexjs]
global = 
ext = 
local =

For each section, you may specify a comma-separated list of JavaScript files. They will be included in the order they are specified.

For global JavaScript files, you should create a directory named flex in your chrome/common/js directory, which is typically /usr/share/trac/htdocs/js.

For local JavaScript files, create a directory in your project directory called htdocs (if it does not already exist), and then create a js directory within that directory.

Finally, in order for local JavaScript files to work, make sure that your web server has an alias for /chrome/site that points to the htdocs directory within your Trac project.

Are you using this plugin?
  • Yes
  • No

Bugs/Feature Requests

Existing bugs and feature requests for FlexJsPlugin are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from here.

Source

You can check out FlexJsPlugin from here using Subversion, or browse the source with Trac.

Example

In trac.ini, this configuration:

[flexjs]
global = foo.js,bar.js
local = blah.js
ext = http://example.com/test1.js,http://example.com/test2.js

Will result in this addition to the <head> of your pages:

 <script type="text/javascript" src="/chrome/common/js/flex/foo.js"></script>
 <script type="text/javascript" src="/chrome/common/js/flex/bar.js"></script>
 <script type="text/javascript" src="http://example.com/test1.js"></script>
 <script type="text/javascript" src="http://example.com/test2.js"></script>
 <script type="text/javascript" src="/chrome/site/js/blah.js"></script>

Recent Changes

[1298] by clay on 09/24/06 06:27:36

FlexJsPlugin:

Initial commit

[1297] by clay on 09/24/06 06:20:10

New hack FlexJsPlugin, created by clay

Author/Contributors

Author: clay
Contributors: