On Monday, January 3, 2011 7:22:34 PM UTC-2, aapaap wrote:
>
> My second suggestion is to make the serialized output somewhat more
> readible,
> by inserting linefeeds ( and if possible indentation, but that might be
> quit difficult)
> so debugging becomes somewhat easier.
>
I though about this also, but one thing must be considered, this will
increase the output size, so it would have to be optional.
I also though of something more broader, that would help high traffic sites.
Default views and layouts for web2py are quite nice, but too verbose. One
could use a manual compressor or minifier when going to production, but this
is tedius and error prone, and a burden when changing things. Also, external
programs may not be aware of web2py and screw things (template views syntax
comes to mind).
This could be done elegantly by web2py itself, with a global flag for
example and with a behaviour somewhat like (in ugly pseudo-code):
if ( minify ) {
view_min = view_file + '.min'
if ( not file_exists(view_min) or change_time(view_file) >
change_time(view_min) {
minify_and_save(view_file, view_min)
}
return view_min
} else {
return view_file
}
Like unix "make" tool, it would just cache a minified version of each view,
and in case the view changed after the minified version, it would be
re-generated.
This could apply also to static files os specific types, like js, css, html,
xml, etc..
I believe that this would be very very useful for development, as it would
allow us to have client side stuff well commented and indented, without have
to manage two versions each, a dev one and a clean, optimized and sanitized
one.
Regards,