[Kss-devel] ree-stripout-comments branch merged

Balazs Ree ree at ree.hu
Mon Jun 11 19:14:13 CEST 2007


I finished merging the "stripout comments" branch to the trunk. The goal 
of the changes is make the javascript slightly smaller and slightly 
faster.

Before the merge, I got rid of all the multiline comments constructions 
that caused unreadable code in the first version. It is all single 
line ;;; comments now.


What is new?

We have ;;; comments in the javascript source, and those lines are 
removed in the "production" version of the code by the packer. However 
they are all present in the "development" version.

Lines marked by ;;; include all error and information messages, logging, 
and lots of assertions. Iow, you will have boring error messages in 
production mode if something breaks, but in return you get better 
performance if everything works.

The production and development version will be governed by the RR debug 
mode in Plone. Alternately, the mode is also switchable from the client 
by a cookie. Ie, you can also debug on production servers, without the 
need to change anything at the server side.



The last step that will affect plone.app.kss, is yet missing from the 
merge, this will switch Plone to use the new altrrnating resources. I 
will do this soon. Meanwhile you can test it yourself manually, and this 
is how to do it:

1. In portal_javascript tool, rename ++resource++kukit-src.js to 
   ++resource++kukit.js, and enter the following condition into it:

    here/@@kss_devel_mode/isoff

2. create a new resource like the previous one, with the name  
   ++resource++kukit-devel.js with this condition:

    here/@@kss_devel_mode/ison

    or if you want, you can combine both of these conditions with the 
    current condition that disables kss for anonymous users, but this
    is not important for testing.

It's all set up now. By default you get production mode. If you look at 
FireBug, you see nothing. But you can visit a simple UI at the browser 
page:

     kss_devel_mode/ui

This is a very simplistic interface that will be made nicer later.

It shows you if kss is currently in production or in development mode. 
And you can toggle a browser cookie with the buttons. The setting can 
also be overruled  by RR: if you set debug mode in portal_javascript, kss 
will get into development mode permanently and independently of the 
setting of the cookie.

-- 
Balazs Ree



More information about the Kss-devel mailing list