So I did some more experimenting... I managed to get coffeescript and less 
support to work finally. There may be other parts of OpenBD broken by this 
though (actually, Id be surprised if this didn't break something...) I am 
using the current nightly of OpenBD as of 08/06/2013 to do this.

Anyway, for the brave... Im taking the approach of installing wro4j as a 
filter, and configuring it with a pre-set group called "wro". In my web 
root, I have a folder called "_wro" - any .coffee or .less files in this 
folder will get combined, minified, and gzipped into two files - wro.js and 
wro.css. There are lots of ways to set this up, but this is about as basic 
as you can get. Anyway, step by step to replicate what I did.

1. Modified web.xml by adding the following:

*<filter>*
*  <filter-name>WebResourceOptimizer</filter-name>*
*  <filter-class>ro.isdc.wro.http.WroFilter</filter-class>*
*</filter>*
*<filter-mapping>*
*  <filter-name>WebResourceOptimizer</filter-name>*
*  <url-pattern>/wro.css</url-pattern>*
*  <url-pattern>/wro.js</url-pattern>*
*</filter-mapping>*

2. Create a wro.properties file and put it into WEB-INF like so:

*debug=true*
*disableCache=true*
*gzipResources=true*
*ignoreMissingResources=true*
*
managerFactoryClassName=ro.isdc.wro.extensions.manager.ExtensionsConfigurableWroManagerFactory
*
*
preProcessors=coffeeScript,cssUrlRewriting,cssImport,semicolonAppender,lessCss
*
*postProcessors=cssVariables,cssMinJawr,jsMin*

The 1st 3 lines can be modified as needed - 
see https://code.google.com/p/wro4j/wiki/ConfigurationOptions
I just chose to be conservative for testing.

3. Create a wro.xml file and put it into WEB-INF like so:

*<?xml version="1.0" encoding="UTF-8"?>*
*<groups xmlns="http://www.isdc.ro/wro"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">*
*  <group name="wro">
*
*    <js>/_wro/*.coffee</js>*
*    <css>/_wro/*.less</css>*
*  </group>*
*</groups>*

4. Remove the following jars from WEB-INF/lib (they will be replaced with 
different versions):

*commons-io-1.4.jar*
*commons-pool.jar*
*sl4j-api-1.6.1.jar*

5. Add the following jars to WEB-INF/lib (the url next to each jar is where 
to find it - they are generally inside of a zip file for each download):

*js.jar* - https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip
*commons-pool-1.6.jar*- 
http://commons.apache.org/proper/commons-pool/download_pool.cgi
*commons-io-2.4.jar*- 
http://commons.apache.org/proper/commons-io/download_io.cgi
*commons-lang3-3.1.jar*- 
http://commons.apache.org/proper/commons-lang/download_lang.cgi
*sl4j-api-1.5.6.jar* - http://www.slf4j.org/dist/
*wro4j-core-1.6.3.jar* - https://code.google.com/p/wro4j/downloads/list
*wro4j-extensions-1.6.3.jar*- https://code.google.com/p/wro4j/downloads/list

6. Put a couple of test resource files in /_wro/

test.coffee:

*alert "foo"*

test.less

*@color: #4D926F;*
*
*
*body {*
*  color: @color;*
*}*

Add more .less and .coffee files if you want to test combining.

7. Setup an index.cfm in the root of the site to load up the wro resources:

*<html>*
*  <head>*
*    <title>Web Frameworks Comparison</title>*
*    <link rel="stylesheet" type="text/css" href="/wro.css" />*
*    <script type="text/javascript" src="/wro.js"></script>*
*  </head>*
*  <body>*
*    test*
*  </body>*
*</html>*

At this point if you run openbd and hit /index.cfm you should see an alert 
message and the word test in green.

Heath

On Monday, October 7, 2013 3:18:39 AM UTC-5, Andy Wu wrote:
>
> Hi Galvanash, 
>
> I'll certainly take a look at it and see what we can do with it. 
>
> Thanks 
> Andy 
>
> On 06/10/2013 21:35, galvanash wrote: 
> > I took a stab at integrating this into my openbd site: 
> > 
> > https://code.google.com/p/wro4j/ 
> > 
> > I managed to get it to sort of work, but there are numerous problems... 
> > 
> > 1. Different versions of sl4j-api used. Minor issue, downgraded to 
> > 1.5.6 to make the warns go away. 
> > 2. Uses much newer versions of many of the apache commons stuff 
> > (lang3, io, pool). Just for kicks I upgraded a few of these jars to 
> > make it happy and it worked (but it might have/probably broke other 
> > parts of OpenBD - didn't test fully). 
> > 3. Biggest issue - Rhino version is too old in OpenBD. Never rectified 
> > this one so many/most of the pre and post processors don't work. 
> > 
> > Anyway, no big deal - I was just experimenting. But I was wondering if 
> > a dev might want to take a look at this project for potential use in 
> > OpenBD. This is a far superior solution to combining and minifying 
> > css/js than the current approach using cfstylesheet/cfjavascript as it 
> > supports less, sass, coffescript, etc as pre and post processors. It 
> > also can gzip the output and a few other neat things. 
> > 
> > For now I am just using it in my build steps as a command line tool - 
> > but having the ability to use it at runtime (as it was designed to be) 
> > would be awesome. 
> > 
> > Galvanash 
> > -- 
> > -- 
> > online documentation: http://openbd.org/manual/ 
> > http://groups.google.com/group/openbd?hl=en 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> > Groups "Open BlueDragon" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to [email protected] <javascript:>. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to