You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bård Magnus Kvalheim <ma...@kvalheim.eu> on 2013/10/03 10:33:28 UTC

[5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

Hi folks.

As part of 5.4 migration process we have some components that make use of
JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .

This library uses the factory approach for defining the modules to work in
both AMD and non AMD environments.
Internally it handles loading of required modules, but work with paths.
(And does not try to load from a fixed directory structure).

So I think I need to specify things like
requirejs.config({
    paths: {
         'jquery.fileupload':
'../library/jquery.fileupload/jquery.fileupload', //path to file
         'jquery.iframe-transport':
'../library/jquery.fileupload/jquery.iframe-transport', //path to file
         'jquery.ui.widget':
'../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
    }
});

Is it possible to add path configuration with tapestry?

One possibility could be to configure shims through tapestry's
modulemanager, but that's for non-AMD scripts and is likely to cause
problems.
Also the shim config would be global (all pages) - which I'd like to avoid
as well.


In 5.3 I've used a JQueryFileUpload to define all the deps like so..
public List<Asset> getJavaScriptLibraries() {
 List<Asset> ret = new ArrayList<Asset>();
ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js",
null));
 ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js",
null));
ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js",
null));
 ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js",
null));
ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js",
null));
 ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js",
null));

I thought it would be nice if it was possible somehow to contribute to
requirejs configuration through stacks.
That way they could be added to the requirejs config if the stack was used.

If it was a service (perhaps exposed through JavaScriptSupport) one could
also contribute on a page/component level..?

I have no idea about the implications of this and if it's possible to
accomplish, but could potentially help solving some more advanced use cases.

In any case I do need to find a solution pretty soon, so let me know if you
have any ideas or suggestions.

Thanks
Magnus

Re: [5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

Posted by Ilya Obshadko <il...@gmail.com>.
Could anyone suggest how to use addModuleConfigurationCallback method for
partial page renders?
Obvious use case is a component that acts as a wrapper around
jQuery-Ajax-Upload library mentioned above.

I need to use this component inside a Zone, but I can't use
addModuleConfigurationCallback in rendering phase because it's not
supported for partial renders.


On Wed, Oct 9, 2013 at 6:29 AM, Lenny Primak <lp...@hope.nyc.ny.us> wrote:

> Voted
>
> On Oct 3, 2013, at 3:44 PM, Bård Magnus Kvalheim wrote:
>
> > Thanks Lenny, JIRA created
> https://issues.apache.org/jira/browse/TAP5-2196
> >
> > Please vote guys :)
> >
> >
> > On Thu, Oct 3, 2013 at 8:02 PM, Lenny Primak <lp...@hope.nyc.ny.us>
> wrote:
> >
> >> +1. I can see lots of things needing this. JIRA please ill vote for it.
> >>
> >>> On Oct 3, 2013, at 1:33 AM, Bård Magnus Kvalheim <ma...@kvalheim.eu>
> >> wrote:
> >>>
> >>> Hi folks.
> >>>
> >>> As part of 5.4 migration process we have some components that make use
> of
> >>> JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .
> >>>
> >>> This library uses the factory approach for defining the modules to work
> >> in
> >>> both AMD and non AMD environments.
> >>> Internally it handles loading of required modules, but work with paths.
> >>> (And does not try to load from a fixed directory structure).
> >>>
> >>> So I think I need to specify things like
> >>> requirejs.config({
> >>>   paths: {
> >>>        'jquery.fileupload':
> >>> '../library/jquery.fileupload/jquery.fileupload', //path to file
> >>>        'jquery.iframe-transport':
> >>> '../library/jquery.fileupload/jquery.iframe-transport', //path to file
> >>>        'jquery.ui.widget':
> >>> '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
> >>>   }
> >>> });
> >>>
> >>> Is it possible to add path configuration with tapestry?
> >>>
> >>> One possibility could be to configure shims through tapestry's
> >>> modulemanager, but that's for non-AMD scripts and is likely to cause
> >>> problems.
> >>> Also the shim config would be global (all pages) - which I'd like to
> >> avoid
> >>> as well.
> >>>
> >>>
> >>> In 5.3 I've used a JQueryFileUpload to define all the deps like so..
> >>> public List<Asset> getJavaScriptLibraries() {
> >>> List<Asset> ret = new ArrayList<Asset>();
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js",
> >>> null));
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js",
> >>> null));
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js",
> >>> null));
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js",
> >>> null));
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js",
> >>> null));
> >>>
> >>
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js",
> >>> null));
> >>>
> >>> I thought it would be nice if it was possible somehow to contribute to
> >>> requirejs configuration through stacks.
> >>> That way they could be added to the requirejs config if the stack was
> >> used.
> >>>
> >>> If it was a service (perhaps exposed through JavaScriptSupport) one
> could
> >>> also contribute on a page/component level..?
> >>>
> >>> I have no idea about the implications of this and if it's possible to
> >>> accomplish, but could potentially help solving some more advanced use
> >> cases.
> >>>
> >>> In any case I do need to find a solution pretty soon, so let me know if
> >> you
> >>> have any ideas or suggestions.
> >>>
> >>> Thanks
> >>> Magnus
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Ilya Obshadko

Re: [5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Voted

On Oct 3, 2013, at 3:44 PM, Bård Magnus Kvalheim wrote:

> Thanks Lenny, JIRA created https://issues.apache.org/jira/browse/TAP5-2196
> 
> Please vote guys :)
> 
> 
> On Thu, Oct 3, 2013 at 8:02 PM, Lenny Primak <lp...@hope.nyc.ny.us> wrote:
> 
>> +1. I can see lots of things needing this. JIRA please ill vote for it.
>> 
>>> On Oct 3, 2013, at 1:33 AM, Bård Magnus Kvalheim <ma...@kvalheim.eu>
>> wrote:
>>> 
>>> Hi folks.
>>> 
>>> As part of 5.4 migration process we have some components that make use of
>>> JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .
>>> 
>>> This library uses the factory approach for defining the modules to work
>> in
>>> both AMD and non AMD environments.
>>> Internally it handles loading of required modules, but work with paths.
>>> (And does not try to load from a fixed directory structure).
>>> 
>>> So I think I need to specify things like
>>> requirejs.config({
>>>   paths: {
>>>        'jquery.fileupload':
>>> '../library/jquery.fileupload/jquery.fileupload', //path to file
>>>        'jquery.iframe-transport':
>>> '../library/jquery.fileupload/jquery.iframe-transport', //path to file
>>>        'jquery.ui.widget':
>>> '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
>>>   }
>>> });
>>> 
>>> Is it possible to add path configuration with tapestry?
>>> 
>>> One possibility could be to configure shims through tapestry's
>>> modulemanager, but that's for non-AMD scripts and is likely to cause
>>> problems.
>>> Also the shim config would be global (all pages) - which I'd like to
>> avoid
>>> as well.
>>> 
>>> 
>>> In 5.3 I've used a JQueryFileUpload to define all the deps like so..
>>> public List<Asset> getJavaScriptLibraries() {
>>> List<Asset> ret = new ArrayList<Asset>();
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js",
>>> null));
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js",
>>> null));
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js",
>>> null));
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js",
>>> null));
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js",
>>> null));
>>> 
>> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js",
>>> null));
>>> 
>>> I thought it would be nice if it was possible somehow to contribute to
>>> requirejs configuration through stacks.
>>> That way they could be added to the requirejs config if the stack was
>> used.
>>> 
>>> If it was a service (perhaps exposed through JavaScriptSupport) one could
>>> also contribute on a page/component level..?
>>> 
>>> I have no idea about the implications of this and if it's possible to
>>> accomplish, but could potentially help solving some more advanced use
>> cases.
>>> 
>>> In any case I do need to find a solution pretty soon, so let me know if
>> you
>>> have any ideas or suggestions.
>>> 
>>> Thanks
>>> Magnus
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


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


Re: [5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

Posted by Bård Magnus Kvalheim <ma...@kvalheim.eu>.
Thanks Lenny, JIRA created https://issues.apache.org/jira/browse/TAP5-2196

Please vote guys :)


On Thu, Oct 3, 2013 at 8:02 PM, Lenny Primak <lp...@hope.nyc.ny.us> wrote:

> +1. I can see lots of things needing this. JIRA please ill vote for it.
>
> > On Oct 3, 2013, at 1:33 AM, Bård Magnus Kvalheim <ma...@kvalheim.eu>
> wrote:
> >
> > Hi folks.
> >
> > As part of 5.4 migration process we have some components that make use of
> > JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .
> >
> > This library uses the factory approach for defining the modules to work
> in
> > both AMD and non AMD environments.
> > Internally it handles loading of required modules, but work with paths.
> > (And does not try to load from a fixed directory structure).
> >
> > So I think I need to specify things like
> > requirejs.config({
> >    paths: {
> >         'jquery.fileupload':
> > '../library/jquery.fileupload/jquery.fileupload', //path to file
> >         'jquery.iframe-transport':
> > '../library/jquery.fileupload/jquery.iframe-transport', //path to file
> >         'jquery.ui.widget':
> > '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
> >    }
> > });
> >
> > Is it possible to add path configuration with tapestry?
> >
> > One possibility could be to configure shims through tapestry's
> > modulemanager, but that's for non-AMD scripts and is likely to cause
> > problems.
> > Also the shim config would be global (all pages) - which I'd like to
> avoid
> > as well.
> >
> >
> > In 5.3 I've used a JQueryFileUpload to define all the deps like so..
> > public List<Asset> getJavaScriptLibraries() {
> > List<Asset> ret = new ArrayList<Asset>();
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js",
> > null));
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js",
> > null));
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js",
> > null));
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js",
> > null));
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js",
> > null));
> >
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js",
> > null));
> >
> > I thought it would be nice if it was possible somehow to contribute to
> > requirejs configuration through stacks.
> > That way they could be added to the requirejs config if the stack was
> used.
> >
> > If it was a service (perhaps exposed through JavaScriptSupport) one could
> > also contribute on a page/component level..?
> >
> > I have no idea about the implications of this and if it's possible to
> > accomplish, but could potentially help solving some more advanced use
> cases.
> >
> > In any case I do need to find a solution pretty soon, so let me know if
> you
> > have any ideas or suggestions.
> >
> > Thanks
> > Magnus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [5.4.22] RequireJs custom path contribution - perhaps on Stacks or JavaScriptSupport

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
+1. I can see lots of things needing this. JIRA please ill vote for it. 

> On Oct 3, 2013, at 1:33 AM, Bård Magnus Kvalheim <ma...@kvalheim.eu> wrote:
> 
> Hi folks.
> 
> As part of 5.4 migration process we have some components that make use of
> JQueryFileUpload, https://github.com/blueimp/jQuery-File-Upload .
> 
> This library uses the factory approach for defining the modules to work in
> both AMD and non AMD environments.
> Internally it handles loading of required modules, but work with paths.
> (And does not try to load from a fixed directory structure).
> 
> So I think I need to specify things like
> requirejs.config({
>    paths: {
>         'jquery.fileupload':
> '../library/jquery.fileupload/jquery.fileupload', //path to file
>         'jquery.iframe-transport':
> '../library/jquery.fileupload/jquery.iframe-transport', //path to file
>         'jquery.ui.widget':
> '../library/jquery.fileupload/vendor/jquery.ui.widget', //path to file
>    }
> });
> 
> Is it possible to add path configuration with tapestry?
> 
> One possibility could be to configure shims through tapestry's
> modulemanager, but that's for non-AMD scripts and is likely to cause
> problems.
> Also the shim config would be global (all pages) - which I'd like to avoid
> as well.
> 
> 
> In 5.3 I've used a JQueryFileUpload to define all the deps like so..
> public List<Asset> getJavaScriptLibraries() {
> List<Asset> ret = new ArrayList<Asset>();
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/vendor/jquery.ui.widget.js",
> null));
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/load-image.min.js",
> null));
> ret.add(assetSource.getContextAsset("jquery-file-upload/extra/js/canvas-to-blob.min.js",
> null));
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.iframe-transport.js",
> null));
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload.js",
> null));
> ret.add(assetSource.getContextAsset("jquery-file-upload/7.2.1/js/jquery.fileupload-fp.js",
> null));
> 
> I thought it would be nice if it was possible somehow to contribute to
> requirejs configuration through stacks.
> That way they could be added to the requirejs config if the stack was used.
> 
> If it was a service (perhaps exposed through JavaScriptSupport) one could
> also contribute on a page/component level..?
> 
> I have no idea about the implications of this and if it's possible to
> accomplish, but could potentially help solving some more advanced use cases.
> 
> In any case I do need to find a solution pretty soon, so let me know if you
> have any ideas or suggestions.
> 
> Thanks
> Magnus

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