How to use wro4j programmatically?

41 views
Skip to first unread message

dutta.d...@gmail.com

unread,
Apr 5, 2017, 4:01:13 AM4/5/17
to wro4j
Hello,

We plan on adding asset bundling and minification capabilities to the LearnITy Framework (https://github.com/diptenduLF/LFwiki). For this we are exploring the use of wro4j. Since the framework uses its own Java based build mechanism to generate markup (HTML) we need to implement the asset bundling and minification from within this Java code. Hence, the Maven plugin is not very useful for us.

Can you give us a guideline as to how we can make use of wro4j programmatically? For example we would like to give the list of input files and the list of processors and produce the bundled and minified file as output.

Regards,

Diptendu Dutta

Alex Objelean

unread,
Apr 5, 2017, 4:29:09 AM4/5/17
to wro4j
Hi, 

the wro4j library responsibility is to create bundles of css/js resources, it does not generate markup (HTML). 
There are two ways of generating resources: build-time (maven or other build tools) or runtime (filter/servlet). 
Though it is possible to use it programmatically (you can look at how the maven plugin is implemented -  see resources below), it is not that straightforward. 
It might be a good feature to evolve the library to become more API friendly and I would like to consider in the future (depending on my spare time though... ) 

A few useful resources:
1) Maven plugin implementation (which is a way to programmatically use wro4j)

Let me know if that helps,
Cheers,
Alex
Reply all
Reply to author
Forward
0 new messages