[TYPO3-core] RFC: #15814: Feature: Add a concatenate class

Steffen Kamper info at sk-typo3.de
Sat Sep 25 22:29:24 CEST 2010


Hi Helmut,

thanks for the long reply.

Helmut Hummel schrieb:
> Hi,
> 
> On 25.09.10 20:34, Steffen Kamper wrote:
>> There is no way to concatenate files like javascript or css files / 
>> inline blocks.
> 
> I' a bit cofused.
> 
> t3lib_Compressor already concatenates .css files, but not .js files.
>

i don't want to change compressor for now. Concatenating isn't compress, 
so this could be done by the concatenate class later.

> Now you propose t3lib_Concatenate to concatenate .js, .css files (and
> any other file types) and "inline" blobs. But can this really work out?
> 

yes, as concatenate only does a very simple lowlevel job.

>> The attached patch offers this possibility in a very easy way.
>>
>> Comments:
>> this first patch offers the possibility to concatenate files. The usage 
>> patch shows how to use it, it concatenates all javascript of backend.php
> 
> The concatenation only works if there are no references to other files
> or relative URLs in the JavaScript, right? Can we asure this for all JS
> Scripts?
>
> The patch suggests, that concatanation would work for CSS, but it also
> won't if there are references to images or other CSS files.
> 
> t3lib_Compressor does URL rewriting for CSS but the proposed
> t3lib_Concatenate does not. I do not like to have two classes doing
> similar things. At least for me it's not clear when to use one over the
> other.
>

good comment. I did this with all backend.php js files and it works. But 
url rewriting should be added.
I will use same as compressor but have in mind to let this part kater 
done by concatenate as it belongs to, compressor can simply call it.

> Some comments on the code:
> 
> * If you do not want use t3lib_div::writeFile(), like Marcus suggested,
> you must at least call t3lib_div::fixPermissions() on the created file.

already commented to Marcus, changed in my local code and will be in 
with next patch.

> * I do not understand why memory consumption is a problem for
> t3lib_Concatenate, but not for t3lib_Compressor (which uses
> t3lib_div::writeFile()

suggest you do that with library files like ExtJs as well, too much to 
load in memory. And it's not needed.

> * you use uniqid() to create a unique filename, which will create a new
> file on each hit, because the filename is random (file_exists will
> always fail)

you have to set the file for your context. I don't expect to concatenate 
all inclusions, but one for backend, one for rte, one for each extension 
etc. I don't see a possibility to guess the context, you?


> * Why do you use a enumerated array for $this->scripts and store the key
> inside the array? Why not $this->scripts[$name] or $this->scripts[$file]?
> * Method exists would be obsolete (can be replaced with
> array_key_exists()) if you adapt the storage like mentioned above

ok, i'll check.

> * registered files must be relative to PATH_Site, which is problematic
> if it comes to extensions and the possiblility of different installation
> locations

extensions i see as the extRelPath is relative to typo3. What problem do 
you see with "different installation locations" ?

> * mimeTypes differ from file extensions. A mimeType is something like
> "text/plain" not ".txt" So the variable and method names should be changed
>

any suggestion? I only used a mimeType direct for the fileExtension.

> I guess that's all I found ;)
> 

thx. As i wrote i first want to collect exact these comments to create a 
new patch.

vg Steffen


More information about the TYPO3-team-core mailing list