May any one clarify GPRESOURCES-102 (Mark) ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
SN
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

May any one clarify GPRESOURCES-102 (Mark) ?

SN

 
The issue is - When you have a js file defined in its own bundle and you use that same js in any other bundle rather then using dependsOn (because you want to bundle that file togather with other js files) and if you have cached resource plugin installed, it will trigger this bug. Why - because once the first bundle containing that js file is processed by the hashandcache mapper, the file would have been renamed, when second bundle tries to process the file it won't find it.
Here's what I see in logs
2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)
I have a bundle
'jquery-cookie' {
         resource id:'js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'defer'
     }
And one another bundle
'bundle-two' { resource id:'cookie-js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'head' ... ... ... //some other js/css resources }
Here bundle-two has the issue - and when bundle-two is being processed on server start - I see below line in server logs

2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)

Mark do you think this issue needs to be resolved or this is the expected behavior of resources plugin (i.e resources dont want to support same resource in multiple bundles)

   
Sudhir 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: May any one clarify GPRESOURCES-102 (Mark) ?

Marc Palmer Local

On 16 Aug 2012, at 10:49, "[hidden email]" <[hidden email]> wrote:

>
>  
> The issue is - When you have a js file defined in its own bundle and you use that same js in any other bundle rather then using dependsOn (because you want to bundle that file togather with other js files) and if you have cached resource plugin installed, it will trigger this bug. Why - because once the first bundle containing that js file is processed by the hashandcache mapper, the file would have been renamed, when second bundle tries to process the file it won't find it.
> Here's what I see in logs
> 2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)
> I have a bundle
> 'jquery-cookie' {
>          resource id:'js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'defer'
>      }
>
> And one another bundle
> 'bundle-two' { resource id:'cookie-js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'head' ... ... ... //some other js/css resources }
> Here bundle-two has the issue - and when bundle-two is being processed on server start - I see below line in server logs
>
> 2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)
>
> Mark do you think this issue needs to be resolved or this is the expected behavior of resources plugin (i.e resources dont want to support same resource in multiple bundles)

Hi,

Your info is a little confusing at the moment.

1) Your above code does not define a bundle, it defines a module. Module != bundle. Bundles are automatically created for modules on (one bundle per module) IF and only if there's more than 1 resource in the module (why bundle one file?) and you have not changed the defaultBundle setting or per-resource bundle id

2) The plugin should provide a warning/error at startup. You cannot reuse the same resource in multiple modules.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


SN
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: May any one clarify GPRESOURCES-102 (Mark) ?

SN
Yeah, you are right, I meant to say modules.. 
However following those steps reproduces the issue GPRESOURCES-102 (I.E generates wrong path to bundles and will cause 404)
So may be.. fix could be.. omit the problematic resources instead of having whole bundle fail because of that resource.. 
As its quite confusing tht why wrong path to bundle is being generated.. 

Also, it would be great if we had ability to use the same resource in multiple bundles..
For example - In our app we have some jquery plugins that are required on various screens, but not all screens needs the same plugins.
There are plugins x,y,z screen 1 needs plugin x and z but not y, screen 2 needs plugin x and y but not z.
How do we generate just a single bundle for screen1 so that it contains x, z and some other screen specific resources but not y

 
Thanks    
Sudhir 
 


From: Marc Palmer <[hidden email]>
To: [hidden email]
Sent: Thursday, 16 August 2012 6:20 PM
Subject: Re: [grails-user] May any one clarify GPRESOURCES-102 (Mark) ?


On 16 Aug 2012, at 10:49, "[hidden email]" <[hidden email]> wrote:

>

> The issue is - When you have a js file defined in its own bundle and you use that same js in any other bundle rather then using dependsOn (because you want to bundle that file togather with other js files) and if you have cached resource plugin installed, it will trigger this bug. Why - because once the first bundle containing that js file is processed by the hashandcache mapper, the file would have been renamed, when second bundle tries to process the file it won't find it.
> Here's what I see in logs
> 2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)
> I have a bundle
> 'jquery-cookie' {
>          resource id:'js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'defer'
>      }
>
> And one another bundle
> 'bundle-two' { resource id:'cookie-js', url:[dir:'j', file:'jquery.cookie.js'], disposition:'head' ... ... ... //some other js/css resources }
> Here bundle-two has the issue - and when bundle-two is being processed on server start - I see below line in server logs
>
> 2012-07-31 13:49:52,207 [main] WARN org.grails.plugin.resource.ResourceProcessor - C:\Users\Sudhir\.grails\1.3.7\projects\PROJECT-NAME\tomcat\work\Tomcat\localhost\sbi\grails-resources\j\jquery.cookie.js (The system cannot find the file specified)
>
> Mark do you think this issue needs to be resolved or this is the expected behavior of resources plugin (i.e resources dont want to support same resource in multiple bundles)

Hi,

Your info is a little confusing at the moment.

1) Your above code does not define a bundle, it defines a module. Module != bundle. Bundles are automatically created for modules on (one bundle per module) IF and only if there's more than 1 resource in the module (why bundle one file?) and you have not changed the defaultBundle setting or per-resource bundle id

2) The plugin should provide a warning/error at startup. You cannot reuse the same resource in multiple modules.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: May any one clarify GPRESOURCES-102 (Mark) ?

Marc Palmer Local

On 16 Aug 2012, at 15:12, "[hidden email]" <[hidden email]> wrote:

> Yeah, you are right, I meant to say modules..
> However following those steps reproduces the issue GPRESOURCES-102 (I.E generates wrong path to bundles and will cause 404)
> So may be.. fix could be.. omit the problematic resources instead of having whole bundle fail because of that resource..
> As its quite confusing tht why wrong path to bundle is being generated..
>
> Also, it would be great if we had ability to use the same resource in multiple bundles..
> For example - In our app we have some jquery plugins that are required on various screens, but not all screens needs the same plugins.
> There are plugins x,y,z screen 1 needs plugin x and z but not y, screen 2 needs plugin x and y but not z.
> How do we generate just a single bundle for screen1 so that it contains x, z and some other screen specific resources but not y

The whole point of bundling is to reduce what is sent to the client and improve performance by making that cacheable.

By using the same resources in multiple bundles you defeat this. In some cases initial loads may be quicker, but for sites where people visit multiple pages the performance is likely worse.

I remain unconvinced by the need for this - especially given the complexity it introduces.

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


SN
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: May any one clarify GPRESOURCES-102 (Mark) ?

SN
Our main intention was to keep the number of included js/css files to minimum or just one for a screen.. but yes once cached number of files doesnt make much difference for subsequent requests.. 

Thanks for your clarifications, what do you think about the wrong bundle path and 404 ?
As I said above, may be it can be fixed to not to fail the whole bundle but omit just problematic resource ?

I am concluding that if the resource is required in more then one modules, that resource has to be defined in its own module and the other modules has to use 'dependsOn'
I will verify again if plugin is giving warning about the resource being used in more then one modules...

Thanks   
Sudhir 
 


From: Marc Palmer <[hidden email]>
To: [hidden email]
Sent: Thursday, 16 August 2012 7:54 PM
Subject: Re: [grails-user] May any one clarify GPRESOURCES-102 (Mark) ?


On 16 Aug 2012, at 15:12, "[hidden email]" <[hidden email]> wrote:

> Yeah, you are right, I meant to say modules..
> However following those steps reproduces the issue GPRESOURCES-102 (I.E generates wrong path to bundles and will cause 404)
> So may be.. fix could be.. omit the problematic resources instead of having whole bundle fail because of that resource..
> As its quite confusing tht why wrong path to bundle is being generated..
>
> Also, it would be great if we had ability to use the same resource in multiple bundles..
> For example - In our app we have some jquery plugins that are required on various screens, but not all screens needs the same plugins.
> There are plugins x,y,z screen 1 needs plugin x and z but not y, screen 2 needs plugin x and y but not z.
> How do we generate just a single bundle for screen1 so that it contains x, z and some other screen specific resources but not y

>The whole point of bundling is to reduce what is sent to the client and improve performance by making that cacheable.
>By using the same resources in multiple bundles you defeat this. In some cases initial loads may be quicker, but for sites where people visit multiple pages the performance is likely worse.
>I remain unconvinced by the need for this - especially given the complexity it introduces.


Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Loading...