[TYPO3-core] RFC #13998: Introduce Automatic versioning of CSS and JS files

Lars Houmark lars at houmark.com
Tue Apr 13 07:49:47 CEST 2010


Hi Ernesto,

Thanks for digging into this ;)

> You forgot to mention that this works only with apache's .htaccess
> support and how to turn the setting on/off. Turning that switch "on"
> without a proper rewrite rule will turn the backend unusable. So
> mentioning that and also adding the exact line needed in .htaccess in
> the NEWS.txt will make it more used.

Correct, thanks for adding it. I have adjusted NEWS.txt a bit to 
include the final .htaccess rule (needs additional 2 conditions before 
the rule).

> 1) I don't like the "&" as this assumes that the rest of the
> parameters also have already been htmlspecialchared. Since this by
> "convention" is meant to be done by the last instance just right before
> generating a "html-tag", I prefer to keep the "&" and add some comment
> in the functions header.

I was also unsure about the whole thing, but the current solution seems 
to remove & on all output, which I am not sure if is good. So 
either the function should end up doing the htmlspecialchars (maybe do 
some check to see if it is already done) or each call needs to do this 
afterwards. What do you think?

For beta1 I think it should be okay having it as it is for now.

> 2) For the backend, your patch breaks all Effects from scriptaculous.
> Test the "clear cache" menu above: It wont open. This is because of this
> line in the scriptaculous.js:

Hmm, your'e right, but the implementation of this thing is not too 
pretty, let's hope we can get rid of the entire library soon :)

Your updates fixes it, according to my testing.

> 3) Then there are some "if (TYPO3_MODE == 'BE') {" in the
> class.t3lib_pagerenderer.php which I don't understand. So if we want to
> allow this functionality to be used in the frontend (as the setting in
> the install tool suggests), then this "if's" are in the way.

Yes, I always wanted this for the FE as well, but thought it would be 
way to hard to get this in with the short timeframe I had and how 
difficult core devs can be to pursade, so I just went for the BE method 
to begin with, but made it partly ready for the FE.

Your changes will make it fly in the frontend as well, and I tested it 
in all cases and it works just fine. Great stuff! Now we will not only 
be able to get rid of support issues with too much caching in the 
backend, but CSS and JS improvements to the website it self will also 
be automatically re-cached for each returning visitor. Awesome!

> To allow it also in the FE I would propose to make the setting ternary:
> 
> - default (empty setting) is to skip versioning of files (backwards
> compatible)
> - "embed" means embedding version in filename
> - "querystring" means appending version to filename

Yeah, well I guess maybe the configuration could be a bit difficult to 
understand, but in that case we can update either the code or 
documentation for a later beta.

> Please retest and re-review. Thanks!

Tested and here is my +1 with reading and testing alongside my minor changes.

Attached is what I hope to be the final version (which has also been 
updated to apply cleanly against current trunk), but it is named v7 for 
now :)

I hope someone can do testing (should be easy) really soon, as I 
understand Benni really would like to have this in for beta1.

How to test:

- Patch trunk
- Login to the backend, view source of the "frame" document. There 
should be added ?timestamp to all CSS and JS files. Right click in 
different main frames and see they also get the timestamp added. Adding 
timestamps as query-string is default behavior.
- Run frontend. There should be no added timestamps.
- Go to install tool. Update both versionNumberInFilename configs 
(there is one for BE and FE).
- For FE, try both 'embed' and 'querystring' as config. Remember to add 
the .htaccess rule in the root folder in order to test the embed 
version.
- For BE, just check of the checkbox and reload the backend to see the 
filenames having the timestamp embedded. Though the scriptaculous.js 
should NOT have it embedded, but added to the query-string. This is 
intended behavior, as embedding will break the script.

Other notes:
How to make forced linebreaks in the config_default.php for the install 
tool? I'd like the three line .htaccess rule to be on each line to 
remove confusion and bad copy/paste.

There is still some missing calls to this method from rtehtmlarea, but 
I understand that Stanislas will be working on this, hopefully before 
beta2.

There was a suggestion to add the .htaccess rule to one or more of the 
backend .htaccess files. I am unsure of how to do this? Can someone 
either take care of it or explain me how to? Also the default .hatccess 
file in the dummy should have this improved but I am also unsure how. 
Important in that file is that it is done around line 57 as the next 
rule hereafter will stop .htaccess rules for the backend.

Thanks for all feedback on this one, I am really happy this one will 
make it in :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 13998_v7.diff
Type: application/octet-stream
Size: 19149 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100413/db149291/attachment-0001.obj>
-------------- next part --------------

-- 
Lars Houmark


More information about the TYPO3-team-core mailing list