[Zope-CMF] CSS and .js files: where to put 'em?

Peter Simmons pete@bcmpweb.com
Fri, 14 Feb 2003 09:55:53 +1300


That works but then you lose the editor (e.g. Dreamweaver) knowing what 
to do at least on Windows anyway.

We solved it by putting an extra extension on e.g. style.css.css that 
way the edtiors still know what to do with it. If the file doesn't 
appear its because  the extension isn';t registered fix this by adding

from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSDTMLMethod import FSDTMLMethod
...
other code
...
registerFileExtension('js', FSDTMLMethod)

in the __init__.py file of your product

The first parameter is the extension the second is a class. Another 
example is

from Products.CMFCore.DirectoryView import registerFileExtension
from Products.CMFCore.FSImage import FSImage
...
other code
...
registerFileExtension('ico', FSImage)

I think .css is registered in CMFPlone (or CMFDefault) but redefining 
them is fine if you want to be explict (it just might break the plone 
stuff if you get the class wrong so beware).

The FS types you can use are in CMFCore and all start with FS.

Cheers,
Pete

Andy McKay wrote:

> Usual practice is to make them a DTML object eg: styles.css.dtml
>
> This will become a DTML object of name "styles.css" and lets you do a 
> bit of dtml fiddling if you wish.