开发者

Static css file and xdv

开发者 https://www.devze.com 2023-02-22 09:02 出处:网络
What is the correct method to manage css file versioning using collective.xdv? Now I use nginx to serve css directly. I tried to import them in the css_registry, but if I change a file the merged css

What is the correct method to manage css file versioning using collective.xdv?

Now I use nginx to serve css directly. I tried to import them in the css_registry, but if I change a file the merged css doesn't upd开发者_运维百科ate, I mean, its version number (eg. the 4931 in rescsstylesheets-cachekey4931.css) doesn't get incremented.

I use plone 4.04, any hints?


that's not a version number. that's portal_css tool that merges and caches CSS files together for better performance.

While developing you have to enable CSS/JS debug in order to see changes in real time. Go to ZMI -> portal_css/javascript and check "debug mode" flag to be on.

If I'm not wrong, from plone 4.x you have this enabled by default if you are running your instance in debug mode (bin/instance fg or bin/client fg). If this doesn't occur, check into you zope.conf for "debug-mode = on".


Clicking save in the portal_css ZMI management screen will redo the merging and change the version number in the resources.


You can easily serve CSS files from Zope. If you use plone.app.caching, the static resources (CSS and JS) will be cached in browser forever.

Then you simply copy over CSS from Plone in your rules.xml like this:

<!-- use styles and JavaScript resources from Plone ResourceRegistries -->
<drop theme="/html/head/link" />
<drop theme="/html/head/style" />
<append theme="/html/head" content="/html/head/link | /html/head/style" />


You can do this:

from Products.CMFCore.utils import getToolByName
csstool = getToolByName(context, 'portal_css')
csstool.manage_saveStylesheets()

You can learn more from the Zope API using old-but-good Products.DocFinderTab:

http://svn.plone.org/svn/collective/Products.DocFinderTab/

0

精彩评论

暂无评论...
验证码 换一张
取 消