Quantcast

Resources - How to disable bundling?

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

Resources - How to disable bundling?

mos-7
Is it possible to disable bundling in the resource-plugin?

Lucky guess that does not work:

 twitterbootstrap {
         dependsOn 'jquery'
        
         resource url: '/js/lib/bootstrap.min.js', bundle: null
         resource url: '/css/lib/bootstrap.css', bundle: null
    }


I'm using Grails 2.1.

Cheers,
Mos
---

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

Re: Resources - How to disable bundling?

Tony Zampogna
Why do you need to disable it? Is it for debugging, or for production?

For debugging purposes, you could turn this off by setting the
property "grails.resources.debug" in your Config.groovy to true, like
so:

grails.resources.debug=true

By default, each "module" (i.e. twitterbootstrap) is a bundle (one for
js and one for css). So, if you don't want bundling (which seems odd
to me for production), you could specify a module for each resource
you have.

Does that help?

Tony Zampogna


On Mon, Aug 20, 2012 at 11:48 AM, Mos <[hidden email]> wrote:

> Is it possible to disable bundling in the resource-plugin?
>
> Lucky guess that does not work:
>
>  twitterbootstrap {
>          dependsOn 'jquery'
>
>          resource url: '/js/lib/bootstrap.min.js', bundle: null
>          resource url: '/css/lib/bootstrap.css', bundle: null
>     }
>
>
> I'm using Grails 2.1.
>
> Cheers,
> Mos
> ---
>



--
Tony

---------------------------------------------------------------------
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
star

Re: Resources - How to disable bundling?

mos-7
Hi Tony,

thanks for the feedback. It's for production.

We've got the requirements to not change the file-names for the css- and js-files.
The resources plugin always change the name  (even if no bundling is done).

Cheers,
Mos
---
http://www.mosbase.com/


On Mon, Aug 20, 2012 at 7:50 PM, Tony Zampogna <[hidden email]> wrote:
Why do you need to disable it? Is it for debugging, or for production?

For debugging purposes, you could turn this off by setting the
property "grails.resources.debug" in your Config.groovy to true, like
so:

grails.resources.debug=true

By default, each "module" (i.e. twitterbootstrap) is a bundle (one for
js and one for css). So, if you don't want bundling (which seems odd
to me for production), you could specify a module for each resource
you have.

Does that help?

Tony Zampogna


On Mon, Aug 20, 2012 at 11:48 AM, Mos <[hidden email]> wrote:
> Is it possible to disable bundling in the resource-plugin?
>
> Lucky guess that does not work:
>
>  twitterbootstrap {
>          dependsOn 'jquery'
>
>          resource url: '/js/lib/bootstrap.min.js', bundle: null
>          resource url: '/css/lib/bootstrap.css', bundle: null
>     }
>
>
> I'm using Grails 2.1.
>
> Cheers,
> Mos
> ---
>



--
Tony

---------------------------------------------------------------------
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
star

Re: Resources - How to disable bundling?

Marc Palmer Local

On 21 Aug 2012, at 08:38, Mos <[hidden email]> wrote:

> Hi Tony,
>
> thanks for the feedback. It's for production.
>
> We've got the requirements to not change the file-names for the css- and js-files.
> The resources plugin always change the name  (even if no bundling is done).

This is not correct.

The plugin only changes the names if one of the following is true:

1) you have set bundle ids
2) you have not set bundle ids and you have more than resource per module
3) you have a resource mapper installed that changes the names (e.g. cached-resources plugin, but this is a similar case to 1 & 2 - bundling is a mapper installed by default).

If your files are being renamed to e.g. bundle_xxxx_yyy.* then you are in case 1 and/or 2. If this is so, your options are:

1) Remove explicit bundle:xxxx ids on your resource declarations (won't help for plugin resources)
2) Add "defaultBundle false" to your resource modules if you are not setting bundle id on a per-resource level (again won't help for plugin resources)
3) Set grails.resources.mappers.bundle.excludes = ['**/*'] (this will work for everything in your app)

If your files are being renamed to something else like "4544fffddeeedd554r776dxzzzs" then you must have cached-resources installed.

If you don't want this behaviour, just uninstall the plugin.

You shouldn't be applying optimisations in development that you don't want in production.

BTW you will lose reliable cacheability in production if you have cached-resources installed and remove it.

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
star

Re: Resources - How to disable bundling?

mos-7
Thanks Marc

>  2) Add "defaultBundle false" to your resource modules if you are not setting bundle id on a per-resource level (again won't help for plugin resources)

That works for me!

Cheers,
Mos
---
http://www.mosbase.com/


On Tue, Aug 21, 2012 at 12:11 PM, Marc Palmer <[hidden email]> wrote:

On 21 Aug 2012, at 08:38, Mos <[hidden email]> wrote:

> Hi Tony,
>
> thanks for the feedback. It's for production.
>
> We've got the requirements to not change the file-names for the css- and js-files.
> The resources plugin always change the name  (even if no bundling is done).

This is not correct.

The plugin only changes the names if one of the following is true:

1) you have set bundle ids
2) you have not set bundle ids and you have more than resource per module
3) you have a resource mapper installed that changes the names (e.g. cached-resources plugin, but this is a similar case to 1 & 2 - bundling is a mapper installed by default).

If your files are being renamed to e.g. bundle_xxxx_yyy.* then you are in case 1 and/or 2. If this is so, your options are:

1) Remove explicit bundle:xxxx ids on your resource declarations (won't help for plugin resources)
2) Add "defaultBundle false" to your resource modules if you are not setting bundle id on a per-resource level (again won't help for plugin resources)
3) Set grails.resources.mappers.bundle.excludes = ['**/*'] (this will work for everything in your app)

If your files are being renamed to something else like "4544fffddeeedd554r776dxzzzs" then you must have cached-resources installed.

If you don't want this behaviour, just uninstall the plugin.

You shouldn't be applying optimisations in development that you don't want in production.

BTW you will lose reliable cacheability in production if you have cached-resources installed and remove it.

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...