[ANNOUNCE] Tengine-1.2.2

locojohn nginx-forum at nginx.us
Tue Jan 24 18:05:24 UTC 2012


Hello,

Joshua Zhu, I find http-concat module very useful indeed.   Except there
are a few minor issues that hopefully will be fixed in the new
version(s):

1. It is not possible to define files from alternate folder followed by
files defined by another folder, for example:

/jquery/??jquery.asmselect.css,ui.imageuploader.css,jquery.linkselect.css
   => works

but

/jquery/??jquery.asmselect.css,ui.imageuploader.css,jquery.linkselect.css,/site-default.css
 => doesn't work

(site-default.css resides in the root)

Suggestion is therefore if "/" is used as a prefix for consequent files,
then treat this component as absolute URL

2. Some CSS files may contain relative links to images.  However, when
these CSS files are concatenated using http-concat from a page residing
in a different folder, links to images will not of course work anymore,
as they become relative to the current page.   For example: 
"jquery-ui-1.8.17.custom.css" of the standard jquery library contains 8
links to images/* and of course they don't work.

We wrote our own PHP script to automatically parse CSS files and fix the
url's by using the following perl regex:

$path = dirname($e['uri']);
// example: url(relative/path/to/file) becomes:
url(/absolute/and/not/relative/path/to/file) within a CSS file
$buf =
preg_replace('/(:?\s*url\s*\()[\'"\s]*([^\/\'"].*)[\'"\s]*\)/isU', '$1'
. ($path == '/' ? '/' : $path . '/') . '$2)', $buf);

It doesn't seem to create a big processing overhead, since the files are
read from disk anyway, and this only does a replace operation in the
memory buffer.   what do you say?  would it be possible to implement?

Also, Antonio, you did a great job to distribute http-concat on git, but
the link to download the archive does not appear to have a .gz/.zip
extension, and, for example, in Gentoo distribution it creates problems
when using "unpack()" function in its ebuilds, as it doesn't know what
type of archive it is:

https://nodeload.github.com/perusio/nginx-http-concat/tarball/master

(doesn't end with ".gz")

Also, there is no version information.

Best regards

Andrejs

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221087,221584#msg-221584



More information about the nginx mailing list