Code Monkey home page Code Monkey logo

wro4j's Introduction

wro4j's People

Contributors

alexo avatar alf239 avatar burtbeckwith avatar candrews avatar computerlove avatar dmitrye avatar dparoulek avatar eivindw avatar filirom1 avatar gconaty avatar genuinefafa avatar gonzalad avatar greg-pendlebury avatar heldeen avatar ivarconr avatar jerolba avatar jgritman avatar julienwol avatar kevoriordan avatar kmadel avatar mart-bogdan avatar martin-g avatar michael-simons avatar muffl0n avatar mwanji avatar nhajratw avatar nigelzor avatar olim7t avatar peterdavehello avatar shirosaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wro4j's Issues

Optimizing CoffeeScript.java

I'm looking at directly depending on wro4j-extensions so that I can get at your CoffeeScript.java implementation from my jasmine-maven-plugin.

I'm planning to compile to JavaScript both at build-time and run-time, and it looks like this implementation behaves as I'd hope it would. My Coffee is magically transforming into JavaScript. Yay!

My only concern is performance. If a project has dozens of CoffeeScript files to be compiled, one-at-a-time, then this implementation appears to be pretty slow... I presume it's because coffee-script.js is being read in once-per-script, and each script incurs the Rhino startup cost.

Is this something you've considered in the past or have ideas about? I'm going to run some benchmarks later today and may ultimately fork your project and/or implement this behavior a bit differently.

Missing semicolon in HoganJsProcessor output (1.6.1-SNAPSHOT)

Hi

I took the latest code and installed it in my local machine for doing a POC on pre-comiled templates.

When 2 templates are used, the compiled output has no semicolon between the 2 cache entries.

For example, the generated output is

Hogan.cache['person'] = function(c,p,i){var =this;.b(i=i||"");.b("<script id="personTpl" type="text/template">");.b("\n" + i);.b("

");.b(.v(.f("firstName",c,p,0)));.b(" ");.b(.v(.f("lastName",c,p,0)));.b("

");.b("\n" + i);.b("

Blog URL: <a href="");.b(.v(.f("blogURL",c,p,0)));.b("">");.b(.v(.f("blogURL",c,p,0)));.b("

");.b("\n" + i);.b("</script>");.b("\n");return .fl();;}Hogan.cache['address'] = function(c,p,i){var =this;.b(i=i||"");.b("<script id="addressTpl" type="text/template">");.b("\n" + i);.b("

");.b(.v(.f("firstName",c,p,0)));.b(" ");.b(.v(.f("lastName",c,p,0)));.b("

");.b("\n" + i);.b("

Blog URL: <a href="");.b(.v(.f("blogURL",c,p,0)));.b("">");.b(.v(.f("blogURL",c,p,0)));.b("

");.b("\n" + i);.b("</script>");_.b("\n");return _.fl();;};

A ';' is required before "Hogan.cache['address']" in the above output.

Thanks
Ram

ConfigurableWroFilter cannot load extentions

ExtensionsConfigurableWroManagerFactory.populateMapWithExtensionsProcessors was recently renamed, but it's called via reflection from the ConfigurableWroFilter which was still using the old method name "populateMapWithExtensionsProcessors"

I've fixed it and tested it on my local repository 1.4.x branch.
I'll see if I can bundle the fix into a pull request.

Allow HTML compression

wro4j does not automatically gzip HTML pages. It is a huge increase in performance doing so.

Also is recomended to use some HTML minifier to reduce useless characters (although HTML compression is much more important and HTML minification not so much)

Error with v1.6.3 and CSS data URLs

Hey,

Since upgrading to v1.6.3, less files that contain base64 encoded data uris are no longer processed.

For example, if I add a file with the following content to a wro package, the compilation will fail

.test {
background:url(data:image/gif;base64,R0lGODlhBQALAIAAAP7//6a9zyH5BAkAAAAALAAAAAAFAAsAAAILDBx4mrfeEJuQogIAOw==) no-repeat 50% 50%;
}

The exception outputted to the console is

ERROR ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator-process:65 - Failed to process the resource: ro.isdc.wro.model.resource.Resource@17a22c0[CSS,app-dashboard,true] using processor: ro.isdc.wro.extensions.processor.css.LessCssProcessor@1710dc0. Reason: Error in LESS: SyntaxError: expected ')' got '''

(the character after 'got' depends on the file that has provoked the exception)

The package is successfully built when this file is removed, or when v1.6.2 is used.

I've tried quoting the url content and putting it in a variable but it doesn't help, and I can find nothing in the lessc docs or issues on github that suggests there has been a change in syntax.

Any ideas ?

The compilation is using the Node processor, and I have lessc 1.3.3 installed.

File resources in wro.xml are relative to current directory and not project directory in Maven projects

I'm using the wro4j-maven-plugin to manage JS resources in my project. I've configured wro.xml as follows:

<groups xmlns="http://www.isdc.ro/wro">
    <group name="core">
        <js>file:target/javascript-dependencies/**.js</js>
        <js>file:src/main/javascript/**.js</js>
    </group>
</groups>

This works fine when I build the project. However, if I include the project in an aggregate POM (e.g. as a sub-module), the build fails, presumably because wro4j is looking for resources relative to the current directory (which would be that of the aggregating POM, rather than the project).

I've been able to work around this by setting the contextFolder on the plugin to ${project.basedir} and referencing the resources as /target/javascript-dependencies/.js and /src/main/javascript/.js, but it looks a bit inelegant!

Is this the expected behaviour of the file locator? It strikes me it only really makes sense when referencing an absolute resource if that is the case.

wro4j not using spring injected properties when listener is configured

This used to work, but now it seems to only read properties if I put it in the default location of WEB-INF/wro.properties

I am using wro4j 1.6.2

spring

    <bean id="wroFilter" class="ro.isdc.wro.http.ConfigurableWroFilter">
        <property name="properties" ref="wroProperties"/>
    </bean>


    <bean id="wroProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="ignoreResourceNotFound" value="true"/>
        <property name="locations">
            <list>
                <value>WEB-INF/config/wro.properties</value>
                <value>file:${user.home}/ibconf/cae/wro.properties</value>
                <value>file:/etc/ibconf/cae/wro.properties</value>
            </list>
        </property>
    </bean>

Update Closure Compiler to r1918?

There's a new version out. It doesn't fix a bug that's been bothering me, but may as well take this in little steps (the bugfix version will probably be out in two months).

upgrading to mvn 1.4.4 fails

Error: [INFO] --- wro4j-maven-plugin:1.4.4:run (default) @ webapp ---
[WARNING] The POM for ro.isdc.wro4j:wro4j-extensions:jar:1.4.4 is missing, no dependency information available
[WARNING] The POM for org.mockito:mockito-core:jar:1.9.0 is missing, no dependency information available
[WARNING] The POM for org.slf4j:slf4j-log4j12:jar:1.6.4 is missing, no dependency information available
[WARNING] The POM for org.slf4j:slf4j-api:jar:1.6.4 is missing, no dependency information available

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

This looks pretty strange too (look for wro4j-extensions group id)
http://bit.ly/GC1s3L

Problem with maven plugin jsLint mojo.

When the number of reported errors reach 50 for the file the maven build fails with the above error.
If I fix one of the error (that means 49 errors) the build completes with success.
Also even if the errors are 50 or more the log reports it as 52 errors in file and fails.

I am pasting config and js file which will help you to reproduce the issue.
Let me know if I am missing something.

            <plugin>
                <groupId>ro.isdc.wro4j</groupId>
                <artifactId>wro4j-maven-plugin</artifactId>
                    <version>${wro4j.version}</version> 
                    <executions>
                        <execution>
                            <id>validate-js</id>
                            <phase>pre-integration-test</phase>
                            <configuration>
                                <targetGroups>all</targetGroups>      
                                <minimize>false</minimize>
                                <options>bitwise,camelcase,curly,eqeqeq,forin,immed,indent=4,latedef,newcap,noarg,noempty,nonew,quotmark='single',regexp,undef,unused,strict,trailing,maxparams=5,maxcomplexity=5,jquery,predef=['angular','_','window']</options>
                                <failNever>true</failNever>  
                                <wroFile>wro.xml</wroFile> 
                                <ignoreMissingResources>false</ignoreMissingResources> 
                            </configuration>
                            <goals>
                                <goal>jshint</goal>
                            </goals>
                        </execution>
                    </executions>
            </plugin>

and js file with simple console.log
As console is not defined it reports errors

function test() {
'use strict';
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
console.log('Yey!!! thats the choice mate ...');
}

Provide ways to specify Closure params

Hi,

Wro4J supports Closure Compiler but doesn't provide a way to specify Closure options such as language_in and others in the pom.xml file

Best regards

[less-processor] Twitter Bootstrap 2.0 invalid

Hey,
Bootstrap does not compile well with wro4j's current less-processor implementation.
I have issues with code where functions from "mixins.less" are invoked:

e.g.: tooltip.less is compiled as:

//[...]
.tooltip-arrow {
    bottom: 0;
    left: 50%;
    margin-left: -5px;
    border-left: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-right: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-top: 5px solid #000
}

.tooltip.left .tooltip-arrow {
    top: 50%;
    right: 0;
    margin-top: -5px;
    border-top: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-bottom: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-left: 5px solid #000
}

.tooltip.bottom .tooltip-arrow {
    top: 0;
    left: 50%;
    margin-left: -5px;
    border-left: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-right: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-bottom: 5px solid #000
}

.tooltip.right .tooltip-arrow {
    top: 50%;
    left: 0;
    margin-top: -5px;
    border-top: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-bottom: 5px solid #NaNbbaaNaN00NaN00NaN00NaN00NaN;
    border-right: 5px solid #000
}

.tooltip-inner {
    max-width: 200px;
    padding: 3px 8px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    background-color: #000;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px
}

//[...]

it seems like some variables could not resolved correctly.
I tested the latest version from Bootstrap and wro4j 1.4.7.

User defined location of model wro.xml

I placed wro.xml into src/main/resources/ beside wro.properties (maven structure).
This will end up later in target/[projectname]-[projectversion]/WEB-INF/classes/

Now, Wro4j can't find the model: ro.isdc.wro.WroRuntimeException: No valid model was found!

Gzip at runtime and minify/build/compile at build

I am having a hard time to implement gzip at runtime and less + minify + concatenation in the build.

Is there such feature? I could not find anything documented that could do this kind of stuff.
The idea is to use gzip at runtime because it is required and the other processes such as minification, less compiling and file concatenation at build or using the eclipse plugin.
When I add the filter wro4j automatically do the concatenation according to the respective files.

If there is no such thing please take this issue as a feature request because that could be really handy =/

UPDATE:
After creating the issue I did recall the wro4j-maven plugin's extra xml and properties file.
I will try that later to see if that solves my problem. If it does let this be here as a future reference.

AMD Support

The Asynchronous Module Definition (AMD) API specifies a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. This is particularly well suited for the browser environment where synchronous loading of modules incurs performance, usability, debugging, and cross-domain access problems.

The purpose of this issue is to add AMD support to wro4j.

Useful links:

http://requirejs.org/docs/whyamd.html
https://github.com/amdjs/amdjs-api/wiki/AMD

Google code issue page: http://code.google.com/p/wro4j/issues/detail?id=527

Meven plugin error after upgrading to 1.5.0

I am using maven plugin and getting following error after upgrading to 1.5.0.
The same configuration and resources works fine with 1.4.9
I have also upgraded maven to 3.x.

Following is my maven plugin configuration

            <plugin>
                <groupId>ro.isdc.wro4j</groupId>
                <artifactId>wro4j-maven-plugin</artifactId>
                    <version>${wro4j.version}</version> 
                    <executions>
                        <execution>
                            <id>validate-js</id>
                            <phase>pre-integration-test</phase>
                            <configuration>
                                <targetGroups>all</targetGroups>      
                                <minimize>true</minimize>
                                <options>bitwise,camelcase,curly,eqeqeq,forin,immed,indent=4,latedef,newcap,noarg,noempty,nonew,quotmark='single',regexp,undef,unused,strict,trailing,maxparams=5,jquery,predef=['angular','_','window']</options>
                                <failNever>true</failNever>  
                                <wroFile>wro.xml</wroFile> 
                                <ignoreMissingResources>false</ignoreMissingResources> 
                            </configuration>
                            <goals>
                                <goal>jshint</goal>
                            </goals>
                        </execution>
                    </executions>
            </plugin>   

and my wro.xml is as follows

/../libs/com/1.0/sungard.js /js/**.js

I am using mvn -Pvalidate-js clean install to run the profile

Minified css changes image file location

Havin hello.css with:

blub {
background: url(images/test.png);
}

Will result in a minified css with the image path: /src/main/webapp/images/test.png
which is of course not avail when build via maven.

GoogleClosureCompressorProcessor fails with maven plugin in 1.6

Stacktrace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal ro.isdc.wro4j:wro4j-maven-plugin:1.6.0:run (combine-all-js-and-css-code) on project normweb: Exception occured while processing: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception occured while processing: null
at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.execute(AbstractWro4jMojo.java:135)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor.getEncoding(GoogleClosureCompressorProcessor.java:128)
at ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor.newCompilerOptions(GoogleClosureCompressorProcessor.java:181)
at ro.isdc.wro.extensions.processor.js.GoogleClosureCompressorProcessor.process(GoogleClosureCompressorProcessor.java:89)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.LazyProcessorDecorator.process(LazyProcessorDecorator.java:48)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.SupportAwareProcessorDecorator.process(SupportAwareProcessorDecorator.java:39)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.resource.processor.decorator.ExceptionHandlingProcessorDecorator.process(ExceptionHandlingProcessorDecorator.java:56)
at ro.isdc.wro.model.resource.processor.decorator.ProcessorDecorator.process(ProcessorDecorator.java:86)
at ro.isdc.wro.model.group.processor.GroupsProcessor.applyPostProcessors(GroupsProcessor.java:115)
at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:81)
at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:90)
at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:36)
at ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator.get(AbstractSynchronizedCacheStrategyDecorator.java:57)
at ro.isdc.wro.manager.ResourceBundleProcessor.serveProcessedBundle(ResourceBundleProcessor.java:68)
at ro.isdc.wro.manager.WroManager.process(WroManager.java:127)
at ro.isdc.wro.maven.plugin.Wro4jMojo.processGroup(Wro4jMojo.java:214)
at ro.isdc.wro.maven.plugin.Wro4jMojo.doExecute(Wro4jMojo.java:116)
at ro.isdc.wro.maven.plugin.AbstractWro4jMojo.execute(AbstractWro4jMojo.java:133)
... 21 more

cssCompressor documentation is lacking

cssCompressor    CssCompressorProcessor  A css compressor, implemented by Andy Roberts.

This processor could use better documentation on your wiki: https://code.google.com/p/wro4j/wiki/AvailableProcessors

We tried to use this in our application, but it will break styles written using media queries for responsive design because it moves things around for efficiency. This should be documented warning possible users of said processor.

CoffeeScript Processor Runs .js files and logs a bunch of errors

My model has a selection of javascript and coffee files in the JS collection and is configured with the coffeeScript preprocessor.

When the JS/coffee is processed, a ton of warnings are output to the console about the coffescript processor thinking the JS is malformed.

I could turn this logging off with a log4j config, but then I get no notice of an actual syntax error.

How can we see coding errors in the coffee without being bombarded by irrelevant javascript problems.

Can you simply not run the coffescriptProcessor on things with a JS extension? Can the logging see that the error is coffee trying to parse javascript and simply ignore it?

Thanks,
Chris

Resource#isMinimize() is ignored when using the ConfigurableWroManagerFactory

I'm having an issue similar to #26, when running wro4j in build mode.

I'm using the wro4j-maven-plugin, version 1.6.1, and here is my setup:

a.js:

var a = true;
console.log(a);

b.js:

var b = true;
console.log(b);

Resources are specified as follows:

<groups xmlns="http://www.isdc.ro/wro">
  <group name="test">
    <js minimize="false">/a.js</js>
    <js minimize="true">/b.js</js>
  </group>
</groups>

wro.properties:

# General Configuration
debug=true
# Processor Configuration
postProcessors=jsMin

Maven config:

<plugin>
    <groupId>ro.isdc.wro4j</groupId>
    <artifactId>wro4j-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <targetGroups>test</targetGroups>
        <extraConfigFile>${basedir}/src/main/resources/wro.properties</extraConfigFile>
        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
        <ignoreMissingResources>false</ignoreMissingResources>
    </configuration>
</plugin> 

When I run mvn clean wro4j:run the output is ignoring the minimize property at the resource level, and test.js looks like this:

var a=true;console.log(a);var b=true;console.log(b);

However, when I take off the <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory> and run the commmand again, then the output is generated correctly (a.js is not minimized while b.js is minimized):

var a = true;
console.log(a);
var b=true;console.log(b);

Any ideas what might be wrong?

CSS / JS minifying does not work anylonger

What steps will reproduce the problem?
Only use the minimization for css / js
(/js/my.js)

What is the expected output? What do you see instead?
The output of css and js should be received in one line, but the files are only copied together without being minified

What version of the product are you using? On what operating system?
1.4.7

Please provide any additional information below.

Problem in LessCss extensibility

Hi Alex,

Recently I needed to upgrade locally less.js to 1.2.1 and faced the following problem:

https://github.com/alexo/wro4j/blob/1.4.x/wro4j-extensions/src/main/java/ro/isdc/wro/extensions/processor/support/less/LessCss.java
has protected method getScriptAsStream() which someone like me should override to provide his own version of less.js.
So far so good but the problem comes from the other two .js files (init.js and run.js) which are loaded with getClass().getResourceAsStream(). Since my class is not in the same package as LessCss these lookups fail to find these two .js files.
A solution is to move those in src/main/resources/ and load them with getClass().getClassLoader().getResourceAsStream().

Import causing model failure

I am stumped on this. My wro.xml builds a model just fine, but when I add a simple import it causes the model creation to fail. The messages don't really say what is causing the failure. I compared my XML to the ones in your tests, and my model appears valid. Any idea why is causing me grief?

Here is a sample of my models and the log:

wro.xml

<?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="jquery">
        <js>/static/mobile/js/jquery/jquery.js</js>
    </group>

    <import>classpath:wro-client.xml</import>
</groups>

wro-client.xml

<?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="example-client-custom">
        <css>/static/client/example-custom.css</css>
    </group>
</groups>

log

2012-11-30 12:52:33 [DEBUG] SchedulerHelper - period: 0 [SECONDS] (http-bio-8080-exec-2, ro.isdc.wro.util.SchedulerHelper, SchedulerHelper.java:98)
2012-11-30 12:52:33 [DEBUG] SchedulerHelper - period: 0 [SECONDS] (http-bio-8080-exec-2, ro.isdc.wro.util.SchedulerHelper, SchedulerHelper.java:98)
2012-11-30 12:52:33 [DEBUG] AbstractSynchronizedCacheStrategyDecorator - Searching cache key: ro.isdc.wro.cache.CacheKey@f81a5b3[
  type=JS
  groupName=jquery
  minimize=true
  map={}
] (http-bio-8080-exec-2, ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator, AbstractSynchronizedCacheStrategyDecorator.java:39)
2012-11-30 12:52:33 [DEBUG] DefaultSynchronizedCacheStrategyDecorator - shouldWatchForChange: false (http-bio-8080-exec-2, ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator, DefaultSynchronizedCacheStrategyDecorator.java:158)
2012-11-30 12:52:33 [DEBUG] AbstractSynchronizedCacheStrategyDecorator - Cache is empty. Loading new value... (http-bio-8080-exec-2, ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator, AbstractSynchronizedCacheStrategyDecorator.java:56)
2012-11-30 12:52:33 [DEBUG] SchedulerHelper - period: 0 [SECONDS] (http-bio-8080-exec-2, ro.isdc.wro.util.SchedulerHelper, SchedulerHelper.java:98)
2012-11-30 12:52:33 [DEBUG] DefaultSynchronizedCacheStrategyDecorator - load value in cache for key: ro.isdc.wro.cache.CacheKey@f81a5b3[
  type=JS
  groupName=jquery
  minimize=true
  map={}
] (http-bio-8080-exec-2, ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator, DefaultSynchronizedCacheStrategyDecorator.java:89)
2012-11-30 12:52:33 [DEBUG] GroupsProcessor - Starting processing group [jquery] of type [JS] with minimized flag: true (http-bio-8080-exec-2, ro.isdc.wro.model.group.processor.GroupsProcessor, GroupsProcessor.java:69)
2012-11-30 12:52:33 [DEBUG] XmlModelFactory - number of imports: 1 (http-bio-8080-exec-2, ro.isdc.wro.model.factory.XmlModelFactory, XmlModelFactory.java:236)
2012-11-30 12:52:33 [DEBUG] XmlModelFactory - processing import: classpath:wro-client.xml (http-bio-8080-exec-2, ro.isdc.wro.model.factory.XmlModelFactory, XmlModelFactory.java:240)
2012-11-30 12:52:33 [DEBUG] XmlModelFactory - build model from import: classpath:wro-client.xml (http-bio-8080-exec-2, ro.isdc.wro.model.factory.XmlModelFactory$1, XmlModelFactory.java:262)
2012-11-30 12:52:33 [DEBUG] WroRuntimeException - Cannot build model from XML (http-bio-8080-exec-2, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)
2012-11-30 12:52:33 [DEBUG] XmlModelFactory - StopWatch 'Create Wro Model from XML': running time (millis) = 0
-----------------------------------------
ms     %     Task name
-----------------------------------------
 (http-bio-8080-exec-2, ro.isdc.wro.model.factory.XmlModelFactory, XmlModelFactory.java:182)
2012-11-30 12:52:33 [DEBUG] XmlModelFactory - StopWatch 'Create Wro Model from XML': running time (millis) = 21
-----------------------------------------
ms     %     Task name
-----------------------------------------
00021  100%  createDocument
00000  000%  processGroups
 (http-bio-8080-exec-2, ro.isdc.wro.model.factory.XmlModelFactory, XmlModelFactory.java:182)
2012-11-30 12:52:33 [DEBUG] SmartWroModelFactory - [FAIL] creating model... will try another factory (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.SmartWroModelFactory, SmartWroModelFactory.java:182)
2012-11-30 12:52:33 [DEBUG] WroRuntimeException - Invalid model found! (http-bio-8080-exec-2, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)
2012-11-30 12:52:33 [DEBUG] GroovyModelFactory - StopWatch 'Create Wro Model from Groovy': running time (millis) = 0
-----------------------------------------
ms     %     Task name
-----------------------------------------
 (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.GroovyModelFactory, GroovyModelFactory.java:75)
2012-11-30 12:52:33 [DEBUG] SmartWroModelFactory - [FAIL] creating model... will try another factory (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.SmartWroModelFactory, SmartWroModelFactory.java:182)
2012-11-30 12:52:33 [DEBUG] WroRuntimeException - Invalid model found! (http-bio-8080-exec-2, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)
2012-11-30 12:52:33 [DEBUG] JsonModelFactory - StopWatch 'Create Wro Model from Groovy': running time (millis) = 0
-----------------------------------------
ms     %     Task name
-----------------------------------------
00000  ?  createModel
 (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.JsonModelFactory, JsonModelFactory.java:64)
2012-11-30 12:52:33 [DEBUG] SmartWroModelFactory - [FAIL] creating model... will try another factory (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.SmartWroModelFactory, SmartWroModelFactory.java:182)
2012-11-30 12:52:33 [ERROR] SmartWroModelFactory -  Using XmlModelFactory for model creation..
[FAIL] Model creation using XmlModelFactory failed. Trying another ...
[FAIL] Exception occured while building the model using: XmlModelFactory Cannot build model from XML Using GroovyModelFactory for model creation..
[FAIL] Model creation using GroovyModelFactory failed. Trying another ...
[FAIL] Exception occured while building the model using: GroovyModelFactory Invalid model found! Using JsonModelFactory for model creation..
[FAIL] Model creation using JsonModelFactory failed. Trying another ...
[FAIL] Exception occured while building the model using: JsonModelFactory Invalid model found! (http-bio-8080-exec-2, ro.isdc.wro.extensions.model.factory.SmartWroModelFactory, SmartWroModelFactory.java:193)
2012-11-30 12:52:33 [DEBUG] WroRuntimeException - Cannot create model using any of provided factories (http-bio-8080-exec-2, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)
2012-11-30 12:52:33 [ERROR] FallbackAwareWroModelFactory - Error while creating the model (http-bio-8080-exec-2, ro.isdc.wro.model.factory.FallbackAwareWroModelFactory, FallbackAwareWroModelFactory.java:50)
ro.isdc.wro.WroRuntimeException: Cannot create model using any of provided factories
    at ro.isdc.wro.extensions.model.factory.SmartWroModelFactory.create(SmartWroModelFactory.java:195) ~[wro4j-extensions-1.6.1.jar:1.6.1]
    at ro.isdc.wro.extensions.model.factory.SmartWroModelFactory.create(SmartWroModelFactory.java:36) ~[wro4j-extensions-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:27) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.FallbackAwareWroModelFactory.create(FallbackAwareWroModelFactory.java:48) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.FallbackAwareWroModelFactory.create(FallbackAwareWroModelFactory.java:22) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.WroModelFactoryDecorator.create(WroModelFactoryDecorator.java:27) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.ModelTransformerFactory.create(ModelTransformerFactory.java:55) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.ModelTransformerFactory.create(ModelTransformerFactory.java:27) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.DefaultWroModelFactoryDecorator$1.initialize(DefaultWroModelFactoryDecorator.java:60) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.DefaultWroModelFactoryDecorator$1.initialize(DefaultWroModelFactoryDecorator.java:50) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.util.LazyInitializer.get(LazyInitializer.java:32) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.DefaultWroModelFactoryDecorator.create(DefaultWroModelFactoryDecorator.java:117) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.factory.DefaultWroModelFactoryDecorator.create(DefaultWroModelFactoryDecorator.java:35) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.model.group.processor.GroupsProcessor.process(GroupsProcessor.java:72) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:90) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.cache.support.DefaultSynchronizedCacheStrategyDecorator.loadValue(DefaultSynchronizedCacheStrategyDecorator.java:36) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator.get(AbstractSynchronizedCacheStrategyDecorator.java:57) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.manager.ResourceBundleProcessor.serveProcessedBundle(ResourceBundleProcessor.java:68) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.manager.WroManager.process(WroManager.java:127) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.http.WroFilter.processRequest(WroFilter.java:328) [wro4j-core-1.6.1.jar:1.6.1]
    at ro.isdc.wro.http.WroFilter.doFilter(WroFilter.java:270) [wro4j-core-1.6.1.jar:1.6.1]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [catalina.jar:7.0.27]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) [catalina.jar:7.0.27]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) [catalina.jar:7.0.27]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) [catalina.jar:7.0.27]
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) [catalina.jar:7.0.27]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [catalina.jar:7.0.27]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [catalina.jar:7.0.27]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) [tomcat-coyote.jar:7.0.27]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) [tomcat-coyote.jar:7.0.27]
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) [tomcat-coyote.jar:7.0.27]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_33]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_33]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_33]
2012-11-30 12:52:33 [ WARN] FallbackAwareWroModelFactory - Couldn't load new model, reusing last Valid Model! (http-bio-8080-exec-2, ro.isdc.wro.model.factory.FallbackAwareWroModelFactory, FallbackAwareWroModelFactory.java:53)
2012-11-30 12:52:33 [DEBUG] WroRuntimeException - No valid model was found! (http-bio-8080-exec-2, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)
2012-11-30 12:52:33 [DEBUG] DefaultWroModelFactoryDecorator - StopWatch 'Create Model': running time (millis) = 26
-----------------------------------------
ms     %     Task name
-----------------------------------------
00026  100%  createModel
 (http-bio-8080-exec-2, ro.isdc.wro.model.factory.DefaultWroModelFactoryDecorator$1, DefaultWroModelFactoryDecorator.java:66)
2012-11-30 12:52:33 [DEBUG] WroFilter - Exception occured (http-bio-8080-exec-2, ro.isdc.wro.http.WroFilter, WroFilter.java:363)
2012-11-30 12:52:33 [DEBUG] WroFilter - Cannot process. Proceeding with chain execution. (http-bio-8080-exec-2, ro.isdc.wro.http.WroFilter, WroFilter.java:365)

TIA

less4j 0.0.4 pulls in unwanted classes

The less4 jar comes as a standalone version only. That means that all dependencies (including slf4j-log4j for example) come packaged with the less4j dependency and classes might end up on the classpath twice.
See also SomMeri/less4j#49

CssImportPreProcessor and CssUrlRewritingProcessor produce invalid image URL when using nested imports

I use wro4j maven plugin version 1.4.5 with CssImportPreProcessor and CssUrlRewritingProcessor. I have an issue with URL rewriting, it seems to not work correctly when I do several nested CSS imports.

My resource directory layout looks like this:

- css
  - index.css
  - dummy
    - index.css
    - dummy.css
- img
  - dummy.png

I'm importing css files via index files like this:

/css/index.css:

@import url('dummy/index.css');

/css/dummy/index.css:

@import url("dummy.css");

/css/dummy/dummy.css:

.dummy { background-image:url(../../img/dummy.png); }

When I run this through CssImportPreProcessor and CssUrlRewritingProcessor, url of background-image is not rewritten correctly (note that it starts with css):

.dummy { background-image:url(../css/img/dummy.png); }

Correct output is:

.dummy { background-image:url(../img/dummy.png); }

I'm using manager factory to setup wro4j (it's based on YUIStandaloneManagerFactory):

public abstract class MyWroManagerFactory extends ExtensionsStandaloneManagerFactory {

    @Override
    protected ProcessorsFactory newProcessorsFactory() {
        final SimpleProcessorsFactory factory = new SimpleProcessorsFactory();

        factory.addPreProcessor(new CssImportPreProcessor());
        factory.addPreProcessor(new CssUrlRewritingProcessor());

        return factory;
    }

I've found out that I can solve this issue simply by switching the order of pre-processors, with CssUrlRewritingProcessor coming first. If this fix is correct, it should be probably done in YUIStandaloneManagerFactory too.

Create RJSON Processor

RJSON converts any JSON data collection into more compact recursive form. Compressed data is still JSON and can be parsed with JSON.parse. RJSON can compress not only homogeneous collections, but also any data sets with free structure.

Create a processor which could be used on javascript resources, which would compress JSON using the RJSON algorithm.

error when use jsonhpack manually

i got this error when try to use JsonHPack manually:

JsonHPack jsonHPack = new JsonHPack();
String packed = jsonHPack.pack(json);

Exception in thread "main" ro.isdc.wro.extensions.WroRuntimeException: Could not execute the script because: SyntaxError: missing ; before statement (pack#1(eval)#2)

im using a edge version from github.

Create css/js suffix

Given is a css/js group named: "hello".
If somebody compiles that through wro4j maven plugin, the result is:

hello.js
hello.css

I would like to have a chance to enter a suffix in the configuration:

hello ${basedir}/src/main/webapp/javascript/ ${basedir}/src/main/webapp/styles/ wro.xml min.${project.version} min.${project.version}

Which should result in:

hello.min.1.2-SNAPSHOT.js
hello.min.1.2-SNAPSHOT.css

or later in production:

hello.min.1.2.js
hello.min.1.2.css

This helps avoiding chaching problems when rolling out a new release

Update Grails Plugin to 1.6.0 / Issue with 1.6.1+

Hi, thanks for your work on this. Just wanted to recommend bumping the dependency in the Grails plugin to 1.6.0. Also wanted to mention that it appears that trying to use 1.6.1 or above throws an error when used in a Grails app. Unfortunately I don't have the exact error message handy, but I thought you'd want to know that there seems to be a conflict somewhere.

Brian

WildcardExpanderModelTransformer throws failure warnings if no assets are found

The warnings make it sound like it failed to process the wildcard resource when the folder doesn't have any matches. The folder exists here, but there are no CSS or JS files in it. This is intentional because the WAR overlays populate some of my wildcard folders. Some different messages for Folder not found and no files found would be clearer about what actaully went wrong here.

2012-11-29 14:13:05 [ WARN] ServletContextUriLocator - [FAIL] localize the stream containing wildcard. Original error message: 'Invalid folder provided, with path: /Users/bbergstrom/projects/webapp/target/base/static/site/, with fileNameWithWildcard: /static/site/**".
 Trying to locate the stream without the wildcard.' (http-bio-8080-exec-28, ro.isdc.wro.model.resource.locator.ServletContextUriLocator, ServletContextUriLocator.java:161)
2012-11-29 14:13:05 [ WARN] ServletContextUriLocator - [FAIL] localize the stream containing wildcard. Original error message: 'Invalid folder provided, with path: /Users/bbergstrom/projects/webapp/target/base/static/site/, with fileNameWithWildcard: /static/site/**.css".
 Trying to locate the stream without the wildcard.' (http-bio-8080-exec-28, ro.isdc.wro.model.resource.locator.ServletContextUriLocator, ServletContextUriLocator.java:161)
2012-11-29 14:13:05 [ WARN] WildcardExpanderModelTransformer - [FAIL] problem while trying to expand wildcard for the following resource uri: /static/site/**.css (http-bio-8080-exec-28, ro.isdc.wro.model.transformer.WildcardExpanderModelTransformer, WildcardExpanderModelTransformer.java:118)

cssImport should support less import-once

http://lesscss.org/#-importing

Using these currently blows up with a Rhino error:

25-Feb-2013 13:21:22    78019 ERROR RhinoScriptBuilder   - JavaScriptException occured: Could not execute the script because: 
25-Feb-2013 13:21:22    {
25-Feb-2013 13:21:22      "type": "Parse",
25-Feb-2013 13:21:22      "message": "Syntax Error on line 6600",
25-Feb-2013 13:21:22      "index": 154928.0,
25-Feb-2013 13:21:22      "filename": null,
25-Feb-2013 13:21:22      "line": 6600.0,
25-Feb-2013 13:21:22      "column": 0.0,
25-Feb-2013 13:21:22      "extract": [
25-Feb-2013 13:21:22        "/* Using  */",
25-Feb-2013 13:21:22        "../../../lib/bootstrap/less/variables.less\";",
25-Feb-2013 13:21:22        "../../../lib/bootstrap/less/mixins.less\";"
25-Feb-2013 13:21:22      ]
25-Feb-2013 13:21:22    }

It would be great if the CssImportPreProcessor supported import-once in addition to import for better support for LessCSS features.

jruby-complete pulls in unwanted classes

Basically the same as #75, but with jruby this time. The jruby-complete artifact is an uberjar, i.e. it is packaged with all classes of its dependencies with their original location, e.g. org.joda.time.DateTime. That makes it impossible to use a different version of any of those libraries.
I think that changing the dependency from jruby-complete to jruby-core should resolve this problem. Is there any reason why wro4j depends on jruby-complete instead?
I also suggest updating jruby to 1.7.2 as jruby-core was apparently broken in pre-1.7 versions (see http://jira.codehaus.org/browse/JRUBY-5848).

Incremental change build should process the target group when the target folder does not exist anymore

As discussed in jbosstools/m2e-wro4j#10 (comment):

since 1.5.0, the wro4j supports incremental change build, meaning that it will process only the group which were affected by a change. In your example, you are remove and append back the semicolon, meaning that no real change is applied on the file itself. Therefore, wro4j assumes there is nothing to process. This is a feature, not a bug :).. .However, it does make sense to process the target group when the target folder does not exist anymore. Could you create an issue on wro4j project ?

Sure it is expected that if the target folder does no exist anymore it should be created.

Why would I remove the target folder?

Simply because it is possible, it is generated files that can be excluded at any time without worry. I can safely remove the folder from maven paths knowing it will be created at the first file change. There is no easy to find documentation telling me that saving the file but does not changing the content will not trigger the plugin even if there is no folder.

The thing is when we want to test something we usually do the process that is documented and see if it works. If it does not work it is impossible to detect why it is not working (we should go to the source and check it but that could take too much time for ppl like me that is not used to develop eclipse plugins).

It makes sense not to recreate the files when we already have them. But if we exclude it should be created again.

Add support for group-ref from imported model to parent model

wro.xml has group 'foo' and imports wro2.xml
wro2.xml defines a group with a group-ref 'foo'.
this currently crashes

2012-12-13 16:17:49 [DEBUG] WroRuntimeException - Invalid group-ref: foo (http-bio-8080-exec-1, ro.isdc.wro.WroRuntimeException, WroRuntimeException.java:30)

It would be a great feature to be able to reference across imports.

add a Listener to initialize Wro Configuration and model

Hi,

I'd like to have a ServletContextListener instead of a filter to initialize Wro Configuration and Model the same way, and then being able to programmatically get the global Wro configuration from servlets or other parts of the application.

I'd like to have a configuration comparable to Spring's ContextLoaderListener and WebApplicationContext.

The use case is with build-time wro4j configuration where we don't need the filter but merely the configuration.

Thanks !

wro4j debug should configure less for debuggin

The wro4j config:

debug=true

Should setup Less for debug processing:

window.less = {
  env: 'development',
  dumpLineNumbers: 'all
};

I can register a custom processor that extends ro.isdc.wro.extensions.processor.support.less.LessCss, but it will result in lots of duplication because of private variables/methods.

groupNameMappingFile and incremental eclipse builds

Hi

I'm using the wro4j maven plugin together with the m2e-wro4j connector (Eclipse).

To perform the mapping from a group to the actual (processed) file I wold like to use the groupNameMappingFile parameter.

The problem that I'm facing is that AbstractWro4jMojo#getTargetGroupsAsList contains an optimization for incremental eclipse builds. After an incremental build the mapping file only contains entries for the changed groups. All mapping information about un-changed groups is lost.

Not sure if this is a bug report or a change request. Either way it would be nice if the mapping file would always contain entries for all groups.

Cheers
michael

CopyrightKeeperProcessorDecorator ignores Resource#isMinimize()

I run CopyrightKeeperProcessorDecorator in wro4j-maven-plugin, version 1.4.4. I setup manager factory like this:

public class MyWroManagerFactory extends ExtensionsStandaloneManagerFactory {

    @Override
    protected ProcessorsFactory newProcessorsFactory() {

        final SimpleProcessorsFactory factory = new SimpleProcessorsFactory();
        factory.addPreProcessor(FixedCopyrightKeeperProcessorDecorator.decorate(YUIJsCompressorProcessor.doMungeCompressor()));
        return factory;
    }

}

I setup my resources like this in wro.xml:

<groups xmlns="http://www.isdc.ro/wro">
    <group name="all">
        <js>resource1</js>
        <js minimize="false">resource2</js>
    </group>
</groups>

Problem is, that both resources are minified. If I remove FixedCopyrightKeeperProcessorDecorator.decorate call, it works as expected, only resource1 is minified.

taglib seeks to resolve wildcards even if exploded is false

Hi Alex,

First of all, this issue is manifesting with wro4j-taglib but I have a feeling it is directly related to wro4j and warnings are being fired from the core library.

We package our app into a war and deploy it. The package includes all the minified bundles but excludes the source files. we don't need sources in QA and production environments.

When deployed, the app runs as expected and the JS bundles are served as expected, but the logs are being filled up with warnings as wro4j attempts to resolve some wildcards in our wro group definitions and does't find the corresponding sources. This is not necessary when the taglib is configured with exploded=false.

I think this happens when an instance of the wroModel is created:
helper.getManagerFactory().create().getModelFactory().create();

Here's a subset of the log:

DEBUG  (JCLLoggerAdapter.java:188) - Expanding resource: /javascript/ga/*.js
DEBUG  (JCLLoggerAdapter.java:188) - computeBaseNameFolder for resource ro.isdc.wro.model.resource.Resource@343947c[JS,/javascript/ga/*.js,true]
DEBUG  (JCLLoggerAdapter.java:188) - resourcePath: /javascript/ga/**
DEBUG  (JCLLoggerAdapter.java:188) - locate resource: /javascript/ga/**
WARN   (JCLLoggerAdapter.java:379) - [FAIL] localize the stream containing wildcard. Original error message: 'Invalid folder provided, with path: /workspace/trunk/dashboard/web/target/project-web-4-SNAPSHOT/javascript/ga, with fileNameWithWildcard: /javascript/ga/**".
 Trying to locate the stream without the wildcard.'

Note: the debug statements are to help understand where it's failing. But it's the WARN entries I'm after.

Support for source map generation

I know there is an old ticket in your Google project, but wanted to get it into your more active Github space for discussion.
https://code.google.com/p/wro4j/issues/detail?id=517

I have been tossing around ideas in my head of how to add support for generating source maps to wro4j, but am encountering some big issues. Thought I would start a discussion about this to see if there is a viable way to implement this.

References

Dependencies

The first question is what information does the source map generation depend on? It needs to know the generated filename, which would be the group name possibly with a naming strategy. It needs to know about the original source files in each group, which are all in the model. It needs to know about the resulting group code files after all concatenation and processing is done. It also should be minimize aware, because the resulting code will differ based on minification. Or at the least, work only in non minified mode, because this feature is really for development, not production.

Design Ideas

Closure

The google closure compiler that is part of wro-extensions already supports source maps, lets take advantage of that.... but this is a processor that will only know of the source files(pre) or the concatenated source(post) and may not be the last processor in the chain. This processor could be extended to be run as both pre and post, persisting information between the two process calls for the mappings and require it to be the last JS processor in the chain. This doesn't do anything for CSS source maps from LESS/SASS.

LESS

LESS.js has support for generating source maps. But, it needs to know the source files. wro4j Less processors are required to run as post processors in order for mixins/variables to resolve across LESS files. Same issue as Closure, the post processors need to know about the source files.

New Processor

We could make a AbstractSourceMapProcessor, with a sub class for JS and CSS. This would need to run as pre and post, persisting information in the thread local context(or some other means) across the process calls to generate the mapping afte the post processing.
This would likely have to take advantage of the 'sections' part of the spec, so that the maps for each source file could be put together after the wro4j group concatenation.
See Source Map Rev 3 doc section titled 'Index map: supporting post processing'.
This is where I hit another problem. LessProcessor is required to run as a POST
This could run similar to the RhinoLessProcessor, using the Mozilla Javascript based source-map library.

Problem Context

For some context on the problem I am solving. Our initial plan was to use 'exploded' mode from the taglib for development, which allows developers to see where the source is for generated CSS.
https://github.com/ibsys/wro4j-taglib#style-syntax
But, this doesn't work because we have multiple levels of LESS stylesheets which have variable/mixin dependencies(Bootstrap, product, client, site).
This works out great when compiling server side using wro4j, but we need a less painful way to develop LESS.

  • Considered removing the LESS dependencies, but that causes us to lose a lot of the benefit of using Twitter Bootstrap.
  • Thought about modifying our WRO model, so that LESS is chained via CSS imports, which would work but makes LESS the exception in our WRO model and would cause us to always create duplicate WRO groups(one with LESS, one without).
  • Could extend the wro4j-taglib so when it detects LESS in exploded mode, to create a fake LESS wrapper stylesheet that imports all the less. The main problem with this is that the generated fake LESS wrapper will have to be at the end of all the tags on the page, which could affect behavior.

I look forward to your input on the topic.

wro.xml support for files outside of `webapp`

I'd really like to store my JavaScript & CoffeeScript sources in src/main/javascript as opposed to src/main/webapp/<something>, but I can't figure out how to do this well.

Given a wro.xml file in src/main/webapp/WEB-INF/wro.xml, I've tried this:

<?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="scripts">
    <js minimize="false">file:../../../javascript/vendor/**.js</js>
    <js>file:../../javascript/**.coffee</js>
    <js>file:../../javascript/**.js</js>
  </group>
</groups>

And this, but resource filtering won't work when the src/ directory is what's being read:

<?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="scripts">
    <js minimize="false">file:${project.basedir}/src/main/javascript/vendor/**.js</js>
    <js>file:${project.basedir}/src/main/javascript/**.coffee</js>
    <js>file:${project.basedir}/src/main/javascript/**.js</js>
  </group>
</groups>

And a few others. Ideas?

RFE: Pass the group (name) to the post processors

Hi,

I'm asking for an improvement in Wro4j API, especially ro.isdc.wro.model.resource.processor.ResourcePostProcessor.process(Reader, Writer).

The preprocessors receive the Resource as first argument in their #process() method.
I'm asking for something similar for the post processors - I need to know the name of the final artifact, i.e. the name of the group that is being postprocessed.
Maybe the type will be also useful. Most of the post processors use @SupportedResourceType and they can be sure what they work with, but maybe there are some processors which process both type ?!

I think the perfect API would be the same as ro.isdc.wro.model.resource.processor.ResourcePreProcessor.process(Resource, Reader, Writer) where the resource is the already merged resource.

I'll be glad to work on that but before starting on it I want to know your opinion on it.

Providers loaded from ServiceLoader cannot override default providers

I was trying to replace the CSS URL rewriter that DefaultProcessorProvider assigns to "cssUrlRewriting" with my own, which is loaded via a ServiceLoader. It wasn't working because the DefaultProcessorProvider was loaded last, so it overwrote my assignments.

Of course, the order the ServiceLoader loads services in is non-deterministic, but a reasonable solution might be to process built-in providers first, so 3rd party ones have a chance to override them?

I worked around it by sorting the providers returned on line 77 of AbstractConfigurableStrategySupport: providers with a package name starting with "ro.isdc.wro" are moved to the beginning of the list.

For reference, here's the code I used:

Collections.sort(providers, new Comparator<P>() {
  public int compare(P provider1, P provider2) {
    boolean isProvider1Core = provider1.getClass().getPackage().getName().startsWith("ro.isdc.wro");
    boolean isProvider2Core = provider2.getClass().getPackage().getName().startsWith("ro.isdc.wro");

    if (isProvider1Core && !isProvider2Core) {
      return 1;
    }

    if (isProvider2Core && !isProvider1Core) {
      return -1;
    }

    return 0;
  }
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.