This is a great little module but I have been having some issues getting this running on my server.

I am running a multisite pressflow installation with memcache and boost installed. Cron is running and I have cleared the cache several times as well as completely disabling it to test if the caching was interfering somehow. I have this module working on my macbook using the latest Aqcuia stack installer which runs php 5.3 i believe.

My status report reads

CSSTidy Compression No Data
Try clearing your cache.

Server config
Apache/2.2.3 (Red Hat)
PHP 5.2.14
MySQL 5.1.47

Anybody have any ideas here? With the server config I am running this modules doesn't save much overall but every little bit helps.

Comments

philbar’s picture

I'll do some test with pressflow when I have a chance. There could be an issue with the way they patch core.

Can you tell me if the source of your HTML files has files listed as the following? *.csstidy.css

If those files are being listed, then we know it is a problem with the reporting feature which is minor.

There is an issue with Boost which prevents the stylesheets from being properly gzipped when there are two periods, but I don't think that is causing your problem.

#940554: CSS files with multiple periods (.) in the filename

cluke009’s picture

No its missing the *.csstidy.css extension on the production machine. I looked in the files/css directory as well and I doesn't look like the files are ever being created. I'll try testing on a vanilla pressflow install as this site has quite a few modules installed that could be interfering.

Edit:

Tested under pressflow 6.19.94 no other modules installed. Got this error Notice: Undefined index: #weight in csstidy_form_alter() (line 14 of csstidy.module). Still not functioning.

cluke009’s picture

Looks like the files aren't being processed because of

  // line 64 of csstidy.module
    $pattern = '/<link(.*?)href="' . preg_quote($path_to_files_directory, '/') . '(.*?)"(.*?)\\/>/';
    if (preg_match_all($pattern, $styles, $matches) > 0) {

The $styles don't match the $pattern so the files aren't being generated.

My regex knowledge is pretty much non-existent but this seems to be where the problem is.

Ran drupal_set_message('testing') after 'if (preg_match_all($pattern, $styles, $matches) > 0) {' under pressflow and drupal to confirm it was not firing in pressflow.

cluke009’s picture

$pattern = '/<link(.*?)href="' . preg_quote($path_to_files_directory, '/') . '(.*?)"(.*?)\\/>/'; is the issue.

drupal prints css paths /sites/all/files/xxx.css and pressflow print the full url http://www.example.com/sites/all/files/xxx.css

We need some kind of place holder after href= that can accept any value or none.

This could be a subdomain or https or nothing depending on which distro your using and your specific site settings.

philbar’s picture

Title: CSS Tidy Not working on production server » Possible Incompatibility with CDN

That shouldn't be a problem if $path_to_files_directory is http://www.example.com/. I have a feeling it is CDN that is interfering. I had Parallel working, but CDN might do things slightly different.

83 	$path_to_files_directory = base_path() . file_directory_path();
84 	$pattern = '/<link(.*?)href="' . preg_quote($path_to_files_directory, '/') . '(.*?)"(.*?)\\/>/'; 

I'll try to test this next week.

philbar’s picture

philbar’s picture

Title: Possible Incompatibility with CDN » Possible Incompatibility with CDN and/or Pressflow

I installed a fresh copy of Pressflow and CSStidy is not working. So it's definitely a problem with Pressflow.

philbar’s picture

Title: Possible Incompatibility with CDN and/or Pressflow » Incompatibility with Pressflow

Tested it with Drupal 6 and CDN and there is no problem there.

realityloop’s picture

This looks like it might be related to the following Pressflow issue:
https://bugs.launchpad.net/pressflow/+bug/597718

I tried this patch, but it didn't resolve the issue for me:
https://code.launchpad.net/~wimleers/pressflow/hook_file_url_alter_bugfi...

wim leers’s picture

@philbar: Glad it works for you!
@realityloop: is this happening with CDN 2.0 RC5?

Let me know if I can be of any help.