You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2011/06/23 01:05:58 UTC

Should we start using RequireJS?

http://requirejs.org/

BSD License

Would replace tapestry.js code that loads script files and do a better
job, especially in IE9, which is likely broken at this time.

-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Should we start using RequireJS?

Posted by Andreas Andreou <an...@gmail.com>.
For the record, i've nothing against requirejs. I like their module work
and it seems to be used in a lot of places (even dojo's 1.7 loader is
able to load requirejs modules and i think they've rewritten their modules
so that they can be loaded by requirejs and other AMD loaders).

Anyway, some more comments inline:

On Fri, Jun 24, 2011 at 20:01, Howard Lewis Ship <hl...@gmail.com> wrote:
> True, perhaps there's a slimmed-down version of requreJS (or something
> similar) that does the loading, and the callback-on-load, but not the
> modules?  Actually, I doubt the modules code is that big a deal.
>
> In any case,
>
> I hadn't thought about working in terms of requireJS modules, and
> given how URLs for JavaScript library assets are organized, it may not
> be possible to use the module name (i.e., require('core')) but always
> the path (require('/assets/123456/tapestry/core.js').
>

That's not the case. In requirejs you can define a base url (in this case
"/assets/123456" and then require("tapestry/core") will work.
You can also define different urls per submodule so that
require("contrib/extra")
loads the code from "/contrib-assets/7890" or whatever
See http://requirejs.org/docs/api.html#config

> However, requireJS modules may not be a bad idea, its where I'm
> already headed with T5.extend().  It will help with modularity and
> namespace management.
>
> It will be interesting to experiment ... for example, perhaps
> requireJS would be the only JS in full page render, and would be
> responsible for bringing in core.js and other main modules.  Or,
> perhaps, requireJS would simply be another JS rolled into the core
> stack.

And of course the other interesting experiment is js/css optimization
through requirejs. The difference with the current work in Tapestry
would be that in the requirejs case you will be able to spread
your js code in multiple files without needing to include all of them in the
stack - you'd just add the one that requires the rest, e.t.c.

>
> Intuitively, bootstrapping using requireJS (the first option) would
> lead to fast page load times.  We will need to update the solution
> that deals with premature clicks/form submits, etc.




-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Apache Tapestry PMC / http://chesstu.be owner
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Should we start using RequireJS?

Posted by Howard Lewis Ship <hl...@gmail.com>.
True, perhaps there's a slimmed-down version of requreJS (or something
similar) that does the loading, and the callback-on-load, but not the
modules?  Actually, I doubt the modules code is that big a deal.

In any case,

I hadn't thought about working in terms of requireJS modules, and
given how URLs for JavaScript library assets are organized, it may not
be possible to use the module name (i.e., require('core')) but always
the path (require('/assets/123456/tapestry/core.js').

However, requireJS modules may not be a bad idea, its where I'm
already headed with T5.extend().  It will help with modularity and
namespace management.

It will be interesting to experiment ... for example, perhaps
requireJS would be the only JS in full page render, and would be
responsible for bringing in core.js and other main modules.  Or,
perhaps, requireJS would simply be another JS rolled into the core
stack.

Intuitively, bootstrapping using requireJS (the first option) would
lead to fast page load times.  We will need to update the solution
that deals with premature clicks/form submits, etc.

On Fri, Jun 24, 2011 at 2:13 AM, Robin Komiwes <ro...@gmail.com> wrote:
> Well, I must admit that Andreas is making a point. LABjs is lighter and do
> one single job: loading CSS/JS.
>
> In a more global way, I would love to see tapestry.js doing less and
> depending more on external solutions.
>
> On Fri, Jun 24, 2011 at 12:58 AM, Andreas Andreou <an...@gmail.com>wrote:
>
>> So, you're talking about a replacement for
>> Tapestry.ScriptManager.loadScript
>> (T.S.addScripts will still be needed I think) and not a modularization
>> of T5 js code
>> into requirejs modules, right?
>>
>> If that's the case, then perhaps requirejs (12.8KB minified) might be
>> overkill. There's also
>> https://github.com/getify/LABjs (4.59KB minified), but...
>> it's interesting to note that you can more or less get this for free
>> in jquery through
>> http://api.jquery.com/jQuery.getScript/ (though
>> https://github.com/got5/tapestry5-jquery
>> isn't yet doing that - it just appends the SCRIPT node to HEAD). So,
>> isn't there a
>> (preferably small) prototype plugin just for that?
>>
>> On Thu, Jun 23, 2011 at 02:05, Howard Lewis Ship <hl...@gmail.com> wrote:
>> > http://requirejs.org/
>> >
>> > BSD License
>> >
>> > Would replace tapestry.js code that loads script files and do a better
>> > job, especially in IE9, which is likely broken at this time.
>> >
>> > --
>> > Howard M. Lewis Ship
>> >
>> > Creator of Apache Tapestry
>> >
>> > The source for Tapestry training, mentoring and support. Contact me to
>> > learn how I can get you up and productive in Tapestry fast!
>> >
>> > (971) 678-5210
>> > http://howardlewisship.com
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: dev-help@tapestry.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
>> Apache Tapestry PMC / http://chesstu.be owner
>> Open Source / JEE Consulting
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: dev-help@tapestry.apache.org
>>
>>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Should we start using RequireJS?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 24 Jun 2011 06:13:29 -0300, Robin Komiwes  
<ro...@gmail.com> wrote:

> Well, I must admit that Andreas is making a point. LABjs is lighter and  
> do one single job: loading CSS/JS.

Agreed.

> In a more global way, I would love to see tapestry.js doing less and
> depending more on external solutions.

Less code for committers to maintain, so they can focus on Tapestry  
itself. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Should we start using RequireJS?

Posted by Robin Komiwes <ro...@gmail.com>.
Well, I must admit that Andreas is making a point. LABjs is lighter and do
one single job: loading CSS/JS.

In a more global way, I would love to see tapestry.js doing less and
depending more on external solutions.

On Fri, Jun 24, 2011 at 12:58 AM, Andreas Andreou <an...@gmail.com>wrote:

> So, you're talking about a replacement for
> Tapestry.ScriptManager.loadScript
> (T.S.addScripts will still be needed I think) and not a modularization
> of T5 js code
> into requirejs modules, right?
>
> If that's the case, then perhaps requirejs (12.8KB minified) might be
> overkill. There's also
> https://github.com/getify/LABjs (4.59KB minified), but...
> it's interesting to note that you can more or less get this for free
> in jquery through
> http://api.jquery.com/jQuery.getScript/ (though
> https://github.com/got5/tapestry5-jquery
> isn't yet doing that - it just appends the SCRIPT node to HEAD). So,
> isn't there a
> (preferably small) prototype plugin just for that?
>
> On Thu, Jun 23, 2011 at 02:05, Howard Lewis Ship <hl...@gmail.com> wrote:
> > http://requirejs.org/
> >
> > BSD License
> >
> > Would replace tapestry.js code that loads script files and do a better
> > job, especially in IE9, which is likely broken at this time.
> >
> > --
> > Howard M. Lewis Ship
> >
> > Creator of Apache Tapestry
> >
> > The source for Tapestry training, mentoring and support. Contact me to
> > learn how I can get you up and productive in Tapestry fast!
> >
> > (971) 678-5210
> > http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
>
> --
> Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
> Apache Tapestry PMC / http://chesstu.be owner
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>

Re: Should we start using RequireJS?

Posted by Andreas Andreou <an...@gmail.com>.
So, you're talking about a replacement for Tapestry.ScriptManager.loadScript
(T.S.addScripts will still be needed I think) and not a modularization
of T5 js code
into requirejs modules, right?

If that's the case, then perhaps requirejs (12.8KB minified) might be
overkill. There's also
https://github.com/getify/LABjs (4.59KB minified), but...
it's interesting to note that you can more or less get this for free
in jquery through
http://api.jquery.com/jQuery.getScript/ (though
https://github.com/got5/tapestry5-jquery
isn't yet doing that - it just appends the SCRIPT node to HEAD). So,
isn't there a
(preferably small) prototype plugin just for that?

On Thu, Jun 23, 2011 at 02:05, Howard Lewis Ship <hl...@gmail.com> wrote:
> http://requirejs.org/
>
> BSD License
>
> Would replace tapestry.js code that loads script files and do a better
> job, especially in IE9, which is likely broken at this time.
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Apache Tapestry PMC / http://chesstu.be owner
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org