The latest Tapestry preview release, 5.4-alpha-7, adds a little bit of
development-time caching to compilation of CoffeeScript and Less assets.

The new version is available at the following Maven repository:

https://repository.apache.org/content/repositories/orgapachetapestry-057/

In development mode, Tapestry monitors all assets that have been exposed to
the client: CSS files, JavaScript libraries, and so forth. When any file
changes, all sorts of caches are cleared.

In normal Tapestry, this is not very noticeable; Tapestry quickly reloads
all the necessary files (changed or not).

Unfortunately, the CoffeeScript compiler is currently limited by the use of
Rhino, the slow JavaScript VM built into the JVM. It can take many seconds
to compile a CoffeeScript file.

alpha-7 introduces a special cache for CoffeeScript and Less; this cache is
based on file content, not date-time-modified (though, as I write this, I'm
wondering if a date-time-modified check would work just as well as the
content check). In any case, this cache is not cleared with the other
caches. When a file has been previously compiled, and its source has not
changed, the compiled version is vended out of the cache.

For Less files, it is smart enough to track the main source file, but also
any files that are read via the @import mechanism built into Less.

As a test, I copied the Bootstrap Less source files into my test
application, and reconfigured Tapestry to use this bootstrap.less in place
of the normal bootstrap.css bundled with the framework.  Results were quite
reasonable:

qtp1995297012-16 [INFO] StreamableResourceSource Compiled
context:bootstrap/css/bootstrap.less to Less in 5229.39 ms
qtp1995297012-16 [INFO] ResourceMinimizer Minimized
context:bootstrap/css/bootstrap.less (124,827 input bytes of text/css to
100,793 output bytes in 3056.71 ms, 19.25% reduction)

I consider being able to dynamically build Bootstrap from its Less source,
and minimize its content, at runtime, to be a bellwether that the
Less/JavaScript/CSS/Minimization support is going to work well for
production applications.

-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Reply via email to