Re: Best practices for using CSS resource references

2012-02-07 Thread Martin Grigorov
Hi,

On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have a LocalResourceScope class (aliased as local shared resource)
 and style.css in the same package. I can access
 resources/local/style.css directly from the browser and track the size
 of HTTP request/response to retrieve CSS.

 I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
 style.css).bind(Application.get())
 expecting it to reduce the amount of traffic, but it actually
 increased request size by about 10%.

Compressing the *response* cannot affect anyhow the *request* size ;-)


 So, why would anybody use CompressedResourceReference when
 contributing CSS? Is there a resource reference that would strip out
 spaces and comments from CSS?

CompressedResourceReference uses GZip to squash the text content, so
all the rules in zip compression are valid here:
- more text content = better compression
- compressing binary content = negative effect

For CSS (text content) the result size should be less than the original.

CompressedResourceReference is removed in Wicket 1.5 because all Web
servers support it for all responses by switching a setting in their
config. No need Wicket to duplicate this support.


 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Jordi Deu-Pons
Hi Alec,

 I'm using this maven plugin on production releases:
http://alchim.sourceforge.net/yuicompressor-maven-plugin/ that
compress the CSS and the JS before packaging it into the WAR.



On Tue, Feb 7, 2012 at 9:06 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have a LocalResourceScope class (aliased as local shared resource)
 and style.css in the same package. I can access
 resources/local/style.css directly from the browser and track the size
 of HTTP request/response to retrieve CSS.

 I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
 style.css).bind(Application.get())
 expecting it to reduce the amount of traffic, but it actually
 increased request size by about 10%.

 Compressing the *response* cannot affect anyhow the *request* size ;-)


 So, why would anybody use CompressedResourceReference when
 contributing CSS? Is there a resource reference that would strip out
 spaces and comments from CSS?

 CompressedResourceReference uses GZip to squash the text content, so
 all the rules in zip compression are valid here:
 - more text content = better compression
 - compressing binary content = negative effect

 For CSS (text content) the result size should be less than the original.

 CompressedResourceReference is removed in Wicket 1.5 because all Web
 servers support it for all responses by switching a setting in their
 config. No need Wicket to duplicate this support.


 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
a10! i fins aviat.
J:-Deu

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Alec Swan
3 responses in one day, awesome!

Serban and Jordi, our app allows users to upload custom CSS so
compile-time solutions will not work for us here.

Martin, if I understood you correctly there is no special support,
such as removing comments, in Wicket for CSS resources, right? If
CompressedResourceReference is removed in 1.5 what should be used
instead? (In migration guide
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html it says
See above)

Thanks,

Alec

On Tue, Feb 7, 2012 at 1:19 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
 Hi Alec,

  I'm using this maven plugin on production releases:
 http://alchim.sourceforge.net/yuicompressor-maven-plugin/ that
 compress the CSS and the JS before packaging it into the WAR.



 On Tue, Feb 7, 2012 at 9:06 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have a LocalResourceScope class (aliased as local shared resource)
 and style.css in the same package. I can access
 resources/local/style.css directly from the browser and track the size
 of HTTP request/response to retrieve CSS.

 I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
 style.css).bind(Application.get())
 expecting it to reduce the amount of traffic, but it actually
 increased request size by about 10%.

 Compressing the *response* cannot affect anyhow the *request* size ;-)


 So, why would anybody use CompressedResourceReference when
 contributing CSS? Is there a resource reference that would strip out
 spaces and comments from CSS?

 CompressedResourceReference uses GZip to squash the text content, so
 all the rules in zip compression are valid here:
 - more text content = better compression
 - compressing binary content = negative effect

 For CSS (text content) the result size should be less than the original.

 CompressedResourceReference is removed in Wicket 1.5 because all Web
 servers support it for all responses by switching a setting in their
 config. No need Wicket to duplicate this support.


 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 a10! i fins aviat.
 J:-Deu

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Martin Grigorov
On Tue, Feb 7, 2012 at 6:30 PM, Alec Swan alecs...@gmail.com wrote:
 3 responses in one day, awesome!

 Serban and Jordi, our app allows users to upload custom CSS so
 compile-time solutions will not work for us here.

 Martin, if I understood you correctly there is no special support,
 such as removing comments, in Wicket for CSS resources, right? If
 CompressedResourceReference is removed in 1.5 what should be used
 instead? (In migration guide
 https://cwiki.apache.org/WICKET/migration-to-wicket-15.html it says
 See above)

There are CssCompressor and JavaScriptCompressor which have no default
impl. You can use YUI compressor or Google Compiler.
CompressedResRef is removed because the web container does this for
you. Check your web container docs.


 Thanks,

 Alec

 On Tue, Feb 7, 2012 at 1:19 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
 Hi Alec,

  I'm using this maven plugin on production releases:
 http://alchim.sourceforge.net/yuicompressor-maven-plugin/ that
 compress the CSS and the JS before packaging it into the WAR.



 On Tue, Feb 7, 2012 at 9:06 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have a LocalResourceScope class (aliased as local shared resource)
 and style.css in the same package. I can access
 resources/local/style.css directly from the browser and track the size
 of HTTP request/response to retrieve CSS.

 I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
 style.css).bind(Application.get())
 expecting it to reduce the amount of traffic, but it actually
 increased request size by about 10%.

 Compressing the *response* cannot affect anyhow the *request* size ;-)


 So, why would anybody use CompressedResourceReference when
 contributing CSS? Is there a resource reference that would strip out
 spaces and comments from CSS?

 CompressedResourceReference uses GZip to squash the text content, so
 all the rules in zip compression are valid here:
 - more text content = better compression
 - compressing binary content = negative effect

 For CSS (text content) the result size should be less than the original.

 CompressedResourceReference is removed in Wicket 1.5 because all Web
 servers support it for all responses by switching a setting in their
 config. No need Wicket to duplicate this support.


 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 a10! i fins aviat.
 J:-Deu

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Martin Grigorov
On Tue, Feb 7, 2012 at 6:30 PM, Alec Swan alecs...@gmail.com wrote:
 3 responses in one day, awesome!

 Serban and Jordi, our app allows users to upload custom CSS so
 compile-time solutions will not work for us here.

 Martin, if I understood you correctly there is no special support,
 such as removing comments, in Wicket for CSS resources, right? If
 CompressedResourceReference is removed in 1.5 what should be used
 instead? (In migration guide
 https://cwiki.apache.org/WICKET/migration-to-wicket-15.html it says
 See above)

The migration guide actually says:

Removed CompressedPackageResource

Since all modern java and web servers support compression of resources
we dropped that feature from wicket. Usually servers not only support
that feature but also are more flexible so there's no need for a
redundant functionality that does not belong to a web framework but to
the server itself.



 Thanks,

 Alec

 On Tue, Feb 7, 2012 at 1:19 AM, Jordi Deu-Pons jo...@jordeu.net wrote:
 Hi Alec,

  I'm using this maven plugin on production releases:
 http://alchim.sourceforge.net/yuicompressor-maven-plugin/ that
 compress the CSS and the JS before packaging it into the WAR.



 On Tue, Feb 7, 2012 at 9:06 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I have a LocalResourceScope class (aliased as local shared resource)
 and style.css in the same package. I can access
 resources/local/style.css directly from the browser and track the size
 of HTTP request/response to retrieve CSS.

 I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
 style.css).bind(Application.get())
 expecting it to reduce the amount of traffic, but it actually
 increased request size by about 10%.

 Compressing the *response* cannot affect anyhow the *request* size ;-)


 So, why would anybody use CompressedResourceReference when
 contributing CSS? Is there a resource reference that would strip out
 spaces and comments from CSS?

 CompressedResourceReference uses GZip to squash the text content, so
 all the rules in zip compression are valid here:
 - more text content = better compression
 - compressing binary content = negative effect

 For CSS (text content) the result size should be less than the original.

 CompressedResourceReference is removed in Wicket 1.5 because all Web
 servers support it for all responses by switching a setting in their
 config. No need Wicket to duplicate this support.


 Thanks,

 Alec

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 a10! i fins aviat.
 J:-Deu

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Serban.Balamaci
Hi Alec,
With wro4j you can do the minification at runtime also by using the
processors like:
http://code.google.com/p/wro4j/wiki/ReusingProcessors
you get to work with Reader and Writer. You could apply the processor after
the resource has been uploaded or even when requested(though probably it's
more efficient to do the first).

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-practices-for-using-CSS-resource-references-tp4362796p4365408.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-07 Thread Alec Swan
Martin, removing CompressResRef in 1.5 makes perfect sense. Thanks for
pointing me to CssCompressor and JavaScriptCompressor.

Serban, thanks for a good link. I can see how I can use wro4j
Reader/Writer code to implement CssCompressor Martin pointed out.

Thanks again, guys!

Alec

On Tue, Feb 7, 2012 at 10:02 AM, Serban.Balamaci thespamtr...@gmail.com wrote:
 Hi Alec,
 With wro4j you can do the minification at runtime also by using the
 processors like:
 http://code.google.com/p/wro4j/wiki/ReusingProcessors
 you get to work with Reader and Writer. You could apply the processor after
 the resource has been uploaded or even when requested(though probably it's
 more efficient to do the first).

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Best-practices-for-using-CSS-resource-references-tp4362796p4365408.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Best practices for using CSS resource references

2012-02-06 Thread Alec Swan
Hello,

I have a LocalResourceScope class (aliased as local shared resource)
and style.css in the same package. I can access
resources/local/style.css directly from the browser and track the size
of HTTP request/response to retrieve CSS.

I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
style.css).bind(Application.get())
expecting it to reduce the amount of traffic, but it actually
increased request size by about 10%.

So, why would anybody use CompressedResourceReference when
contributing CSS? Is there a resource reference that would strip out
spaces and comments from CSS?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Best practices for using CSS resource references

2012-02-06 Thread Serban.Balamaci
Hi Alec,
Not really a direct reply to your question rather another. 
Wro4j project is more powerful(configurable) when it comes to grouping and
minification css/jss, and I think maybe the WroFilter can easily be turned
into a Wicket Resource, for a tighter wicket integration, I'm wondering if
this has not already been done by someone.

Also for JS references a parser for wro.xml that returns the contained js
entries in a group to distinguish between wicket development and deployment
versions could be done.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-practices-for-using-CSS-resource-references-tp4362796p4363970.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org