Search

Sorry for the late reply, but I have just added a quick fix for Opera. It simply checks if the user is using Opera, and if it is, it turns off compressing.

Grab the latest version from the repository!

For those of you having issues on windows boxes, please replace SFCompress.php with the attached version.

Just had to wrap the workspace location in realpath() on lines 362 & 363.

UPDATE: Sorry, the first file was a debug version - Please let me know if there are any bugs in this one.

Attachments:
SFCompress.php

Thanks, dude. I have a hunch this is the cause why this extension wasn't working ...

Will test is asap.

Although it sounds like a very neat extension, I prefer build time aggregation / compression instead of runtime. There is no need to disturb the runtime environment with something you can easily achieve using build tools. But that's how I do it.

Either way: good job!

@remie

How do you compress files at build time? What tools do you use?

I'm currently using Maven, but you can also use Ant, or just some shell script. For aggregation and compression, I use the yuicompressor-maven-plugin.

Very useful, but I've found a couple of potential issues.

I've got in the habit of storing my CSS and JS outside the workspace in a folder called assets. This might be bad practice, but retro-fitting one of my sites to use this required a few modifications.

Also I couldn't use ampersands in the URL without throwing an XSLT processing error - so I had to use & instead - the extension didn't like this at all, so I had to modify the it to process the parameters properly.

Otherwise very good!

Sorry, the second & symbol should have appeared as "& a m p ;" (without the spaces)

I've got in the habit of storing my CSS and JS outside the workspace in a folder called assets. This might be bad practice, but retro-fitting one of my sites to use this required a few modifications.

You can always move the assets folder to your workspace and add a rule to your .htaccess to internally redirect "/assets" to "/workspace/assets"

I have an issue with this ... It was working fine and suddenly (don't know exactly how, when) on compressing CSS files, it turns background image rules from this:

url(images/header.jpg)

to

url(http://example.com/workspace/public/css/SFC.css?path=public&files=css/main.css,css/other.css,css/images/header.jpg)

The URL for processing is:

 http://example.com/workspace/public/css/SFC.css?path=public&files=css/main.css,css/other.css&compress

The problem occurs on normal page load. On refresh page load (Ctrl+F5), it works fine (files are compressed and shipped) ....... What's the catch?

@vladG
I think you probably need to use either absolute paths or try ../images/header.jpg assuming your images directory is at the same level as your css directory.

@jamesmorrish
If you found bugs and bug fixes it would great if you could either share the fix here or on Github!

@remie
By the way, this extension caches the results so in reality it should only process everything once, or once whenever a file changes. There is of course a slight overhead comparing with serving static files (since you have to run PHP), but from my experience on a rather cheap server, that overhead is at around 0.02-0.04 for a request that loads from cache. (Of course, this type of data is not representative for anything...) Add &debug and open up the console tab in Firebug with FirePHP if you want to see the performance on your server.

It seems the problem appears when I connect to Internet from a Mobile USB. When connecting from wired ADSL, everything is fine.

This sounds really weird.. Did you try to use either absolute paths or ../images/header.jpg assuming your images directory is at the same level as your css directory?

Using absolute paths fails ... The are some issues with remote file processing. Here's a dump:

<br />
<b>Deprecated</b>:  Call-time pass-by-reference has been deprecated in <b>[...]\extensions\static_files_compressor\lib\SFCompress.php</b> on line <b>752</b><br />
<br />
<b>Warning</b>:  require_once(PEAR/Exception.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in <b>[...]\extensions\static_files_compressor\lib\HTTP\Request2\Exception.php</b> on line <b>47</b><br />
<br />
<b>Fatal error</b>:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'PEAR/Exception.php' (include_path='.;C:\php\pear') in <b>[...]\extensions\static_files_compressor\lib\HTTP\Request2\Exception.php</b> on line <b>47</b><br />

The included paths are all scrambled in PEAR and HTTP packages. Don really know how to fix it.

Duplicate ...

@vladG try replace line 47 with the following:

require_once dirname(__FILE__) . '/../../PEAR/PEAR/Exception.php';

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details