changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Include support for r.js #367

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if wro4j would have support for the require.js optimizer[1]. 
It's used in dependency management if you'd like to use it to serve one 
optimized file in the beginning, versus having modules loaded asynchronously.

I run it at build time and it works directly through Rhino, without other js 
dependencies. 

[1] https://github.com/jrburke/r.js/

Original issue reported on code.google.com by alex.cim...@gmail.com on 1 Feb 2012 at 10:42

GoogleCodeExporter commented 9 years ago
I was thinking about require.js integration. But I'm not quite sure how those 
two libraries will work together. Can you describe a sample work flow? How do 
you see it?

Original comment by alex.obj...@gmail.com on 1 Feb 2012 at 10:57

GoogleCodeExporter commented 9 years ago
I use r.js to build an optimized JavaScript file that gets distributed on 
mobile. I don't need async loading (the whole source is <10K compressed), but I 
do want a modular structure, namespacing etc. and I thought AMD is a good fit. 
I bundle the code with almond.js[1], instead of require because it's a lot 
lighter and shims require and define to just what I need. r.js is good for 
building because it's smart about dependencies, I give it just the entry-point 
and it takes it from there. I attached the ant target that uses it and a sample 
buildprofile.js that's similar to what I'm using.

For local development we do async loading with require.js, and we don't do any 
optimization/combining of the source files so it helps us when debugging.

Regarding the compatibility of r.js with require, from what I read in the docs 
it should work just fine. R.js is written by the same guy who wrote require.js. 
I can look more into this if you want.

I'm interested in this because we do resource optimization at build time and 
I'd like to use a single library for this. I wrote a small wrapper around a 
Java LessCSS engine[2] with which we generate our stylesheet and we're doing 
the r.js stuff for JavaScript. Then we publish our JS and CSS into a CMS and 
they get automatically minified. The minifier they're using sucks and I want to 
move away from it. Basically I'm looking for an integrated workflow from start 
to finish and wro4j seems exactly what I need.

[1] https://github.com/jrburke/almond
[2] https://github.com/cimi/lesscss-engine

Original comment by alex.cim...@gmail.com on 1 Feb 2012 at 11:29

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for detailed description. I will analyze your workflow and will try to 
figure out what can be done. If you think you can help me to make the progress 
on this issue, your help is appreciated. (a fork with some experimental changes 
would be great).

Original comment by alex.obj...@gmail.com on 1 Feb 2012 at 5:36

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 1 Feb 2012 at 5:36

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 1 Feb 2012 at 10:54

GoogleCodeExporter commented 9 years ago
That's great!

I will try to sketch up a proposal implementation, but I don't think I'll be 
able to get around to it this week. Will send a pull request when done.

Thanks!

Original comment by alex.cim...@gmail.com on 2 Feb 2012 at 6:11

GoogleCodeExporter commented 9 years ago
No hurry :). You can provide the link of the repository where you are planning 
to implement it and I will be able to do the code review and follow the 
progress. 

Original comment by alex.obj...@gmail.com on 2 Feb 2012 at 7:57

GoogleCodeExporter commented 9 years ago
Anybody still working on this? If not i would love to give it a shot.

Original comment by thejos...@gmail.com on 16 Mar 2012 at 5:23

GoogleCodeExporter commented 9 years ago
Nobody is working yet.
Fork the project -> create a branch -> implement the feature -> create pull 
request. 

Thanks,
Alex

Original comment by alex.obj...@gmail.com on 16 Mar 2012 at 5:38

GoogleCodeExporter commented 9 years ago
Sorry I haven't gotten around to that, although I'd said I would. Haven't
managed to find the time. I'm still fully booked for the following weeks,
I'll check back in when I can contribute some time.

Original comment by alex.cim...@gmail.com on 16 Mar 2012 at 7:17

GoogleCodeExporter commented 9 years ago
Don't worry, it is not a fully time job, there is no dead-line or pressure. Any 
contribution is appreciated any time :)

Original comment by alex.obj...@gmail.com on 16 Mar 2012 at 7:22

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 16 Aug 2012 at 5:14