Quantcast

Using yui-minify-resources with lesscss-resources

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Using yui-minify-resources with lesscss-resources

manav.manocha
I installed yui-minify-resources plugin version 0.1.5 and also installed lesscss-resources plugin version 1.3.0.3 in my application.

I have defined following configuration in "ApplicationResources.groovy"

modules = {    
        core {
          resource url:'/css/default/less/accordion.less',attrs:[rel: "stylesheet/less", type:'css'], bundle:'bundle_core'
          resource url:'/css/default/libs/bootstrap.css'
           resource url:'/css/default/main.css'
        }
}

 I have used this module in my GSP page using
<r:require module="core"/>       

But when I run the application using "run-app" , i get the following error

Error 2012-07-16 16:18:54,958 [pool-5-thread-1] ERROR plugins.DefaultGrailsPluginManager  - Error configuring dynamic methods for plugin [resources:1.2-RC1]: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
Message: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
   Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   619 | run . .  in java.lang.Thread
Caused by NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
->> 312 | parse    in com.yahoo.platform.yui.compressor.JavaScriptCompressor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   533 | <init>   in     ''
|    29 | doCall . in com.blockconsult.yuiminifyresources.YuiJsMinifyResourceMapper$_map_closure1
|    28 | map      in com.blockconsult.yuiminifyresources.YuiJsMinifyResourceMapper
|   139 | invoke . in org.grails.plugin.resource.mapper.ResourceMapper
|   128 | invokeIfNotExcluded in     ''
|   589 | applyMappers in org.grails.plugin.resource.ResourceProcessor
|   535 | prepareResource in     ''
|   604 | doCall . in org.grails.plugin.resource.ResourceProcessor$_prepareSingleDeclaredResource_closure12
|    29 | addDeclaredResource in org.grails.plugin.resource.util.ResourceMetaStore
|   602 | prepareSingleDeclaredResource in org.grails.plugin.resource.ResourceProcessor
|   627 | doCall   in org.grails.plugin.resource.ResourceProcessor$_prepareResourceBatch_closure14
|     8 | each . . in org.grails.plugin.resource.ResourceProcessorBatch
|   623 | prepareResourceBatch in org.grails.plugin.resource.ResourceProcessor
|   806 | resourcesChanged in     ''
|   802 | loadModules in     ''
|   1071 | reloadAll in     ''
|   172 | doCall   in ResourcesGrailsPlugin$_closure3
|   303 | innerRun in java.util.concurrent.FutureTask$Sync
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   619 | run . .  in java.lang.Thread


Could you please suggest the solution?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Using yui-minify-resources with lesscss-resources

OverZealous
manav.manocha wrote:
I installed *yui-minify-resources* plugin version 0.1.5 and also installed *lesscss-resources* plugin version 1.3.0.3 in my application.

These two plugins are incompatible.  The YUI-resources plugin uses an embedded, broken version of Rhino (the Mozilla JavaScript parser), and will (most likely) break anything else that uses Rhino within Grails.

Personally, I had a lot of problems with the Less resources plugin, including that you can't debug resources with it (the LESS files are served raw, so you end up with broken styling, if any), and resources would very often not reload the changed file, leading to much frustration when debugging.

Instead, I run a different program that automatically converts the less files into CSS in the background while I work.  I just commit both files to my project, and only use the CSS files within Grails.  This tends to work much better.  I also converted all my CSS files to Less, since you can just rename the file extension.  The Less app will also minify them for me, so I get that gain as well.

I also stopped using YUI resources, but that's not an option for everyone, since I (think) it's the only JS minifying plugin for Grails.  (I can avoid it because I use Dojo, which has its own build process.)

I really should make a plugin that uses Google's Closure Compiler, which is currently often the best JS minifier.

-- 
Phil DeJarnett
OverZealous Creations, LLC




Loading...