Task #55690
closedMake concatenateCss and compressCss generate valid CSS
100%
Description
config.concatenateCss = 1
config.compressCss = 1
do both invalid CSS.
-------------------------------------
Problem with:
config.concatenateCss = 1
output will be:
/* moved by compressor */
@charset "UTF-8";
thats not valid css. @charset "UTF-8"; has to be the first line. no comments allowed before @charset "UTF-8";
-----------------------
Problem with:
config.compressCss = 1
output will be:
@charset"UTF-8";
problem: between @charset and "UTF-8" has to be a space character
Updated by Markus Klein almost 11 years ago
Why are you specifying a charset? Does your server deliver a wrong header for the file?
Updated by Philipp Müller about 10 years ago
@Markus Klein: There are many reasons to use the @charset-declaration. But I think this is not the question, the declaration exists (http://bit.ly/1vjJCa2) and so TYPO3 should support it. Or not?!
Additionally:
If the charset is defined in more than one stylesheet and the concatenation is enabled, there are multiple charset-definitions.
- the concatenation checks if the charset is on top. If not, move it to the top and remove duplicate definitions* and
- the compressor adds the space between the charset and the charset-name (like the font-issue #60675).
*So we can provide the validity and fully support, if the concatenation is on or off.
Updated by Stefan Neufeind almost 10 years ago
In typo3/sysext/core/Classes/Resource/ResourceCompressor.php there is functionality to find and move @charset-etc. That's also where the moved-comment is inserted.
Updated by Riccardo De Contardi over 9 years ago
I have performed a test with both 6.2.14 and 7.4-dev (latest master);
1. I put in fileadmin the following files:
file1.css
@charset "UTF-8"; /*This is a mere test for comments*/ body{ font-family:sans-serif; }
file2.css
@charset "UTF-8"; /*This is a mere test for comments*/ body{ font-size:14px; }
2. TS Setup:
config.concatenateCss = 1 config.compressCss = 1 config.removeDefaultCss=1 page = PAGE page.includeCSS { file1 = fileadmin/file1.css file2 = fileadmin/file2.css } page.10 < styles.content.get
3. Resulting file (typo3temp/compressor/merged-whatever.css?whatever):
TYPO3 6.2.14:
@charset"UTF-8"; @charset"UTF-8"; body{font-family:sans-serif} body{font-size:14px}
TYPO3 7.4-dev:
@charset "UTF-8";@charset "UTF-8";body{font-family:sans-serif;}body{font-size:14px;}
Updated by Riccardo De Contardi almost 9 years ago
- Target version set to Candidate for patchlevel
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47251
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47251
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47251
Updated by Gerrit Code Review over 8 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47251
Updated by Gerrit Code Review over 8 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/47336
Updated by Andreas Fernandez over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c0c8eace4e23d99db1664f505c5b0f0bb4f5d922.