Views.css will not be included into the combined css file, when CSS Optimization in /admin/settings/performance is active. This adds an unnecessary http-request to every page load when views module is used.

Comments

dawehner’s picture

I just want to give you the inline-code

  // We set preprocess to FALSE because we are adding the files conditionally,
  // and we don't want to generate duplicate cache files.

But sure you are true, on sites, with views everywhere, this doesn't make sense.

joergvk’s picture

Our site has blocks created by views on almost every page. I wonder if adding the views.css conditionally is actually neccessary? I'd like to just include it into the cache file when views module is active, otherwise leave it out. The performance penalty of the additonal http-request for the views.css on almost every page for us is much higher than the performance penalty of having a slightly longer cached css.

What do you think about an option in the views admin interface to choose one of the two behaviours?

merlinofchaos’s picture

Honestly at this point views.css should probably just show up in views_init() and be done with it. It's so ubiquitous on most sites that there is little point to doing anything but putting it there full time. And then there is no reason to have it not be cachable, as it once was.

dboulet’s picture

Version: 6.x-2.7 » 6.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new2.09 KB

Here's a patch for Views 3 dev, for review. If this gets accepted, we can port it back to 2.x.

dboulet’s picture

Some thoughts:

  • Should we add a note to hook_init(), explaining why we are not using views_add_css()?
  • Do we need to add a check to views_add_css() to exclude the views.css file? Not sure what would happen if it was added twice.
dyke it’s picture

subscribe

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

The patch works as expected and looks fine.

Bilmar’s picture

subscribing

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 2.x and 3.x; not sure why but it does not apply to 7.x

dawehner’s picture

Status: Patch (to be ported) » Fixed

Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.