changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Split images url from CSS in a separate file #402

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to have 2 CSS files.
First one for image declarations (background-image) (with dataUri)
Second one for others CSS declarations

The first one (for background-image) will be included via JavaScript for 
deferring loading.

Original issue reported on code.google.com by cronier...@gmail.com on 26 Mar 2012 at 1:46

GoogleCodeExporter commented 9 years ago
Can you provide some examples?

Original comment by alex.obj...@gmail.com on 26 Mar 2012 at 2:08

GoogleCodeExporter commented 9 years ago
Also, please provide more background details. Are you using maven plugin or 
runtime solution (filter). Can you describe your use-case? 

Original comment by alex.obj...@gmail.com on 26 Mar 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Sorry for late.

This issue is not a defect but an Enhancement.

I've made an Maven project to describe a use-case.

* dev.html :
    is a page for development phase. No post-processing of CSS
* production.html : 
    is a page with a aggregated CSS and another with extracted images from CSS.
    This second CSS is lazy-loaded to increase web-perf. 

NB : An enhancement of lazyLoading.js can be made to detect if navigator 
support dataUri and switch between a second CSS with image inn DataURI format 
or another with external URL to image

Original comment by cronier...@gmail.com on 24 Apr 2012 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago
I understand your use-case. However I'm not sure how to implement the entire 
workflow and whether it should be available only for build time or also for 
runtime solution?

I would split the issue in few smaller and independent tasks:
1) Create processor which removes all backgrounds from css (alias P1)
2) Create processor which collects all backgrounds from css (alias P2)
3) Create maven plugin (new mojo) which produces two additional css files for 
each processed group, one which uses P1 and the second using P2.

Probably it is possible to create a workflow also for the runtime solution, but 
we should find a way to fit it nicely in overall design. 

Let me know what you think and whether you would like to contribute with some 
of the smaller tasks.

Thanks,
Alex

Original comment by alex.obj...@gmail.com on 31 May 2012 at 6:23

GoogleCodeExporter commented 9 years ago
That's exactly right.

I don't how I can help you for these tasks.

Original comment by cronier...@gmail.com on 1 Jun 2012 at 12:03

GoogleCodeExporter commented 9 years ago
It is not important to know all the details now. If you are willing to 
contribute, I could guide you. Otherwise, I cannot promise it to be ready any 
time soon.

Btw, do you have any metrics or articles proving that the suggested approach 
brings any improvement for overall page rendering time?

Original comment by alex.obj...@gmail.com on 1 Jun 2012 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 1 Jun 2012 at 12:06

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 1 Jun 2012 at 12:06