Project

General

Profile

Actions

Task #55690

closed

Make concatenateCss and compressCss generate valid CSS

Added by Thomas Pronold almost 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Start date:
2014-02-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
Tags:
Complexity:
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #50943: Compressor puts wrong @charsetClosed2013-08-08

Actions
Actions #1

Updated by Markus Klein almost 11 years ago

Why are you specifying a charset? Does your server deliver a wrong header for the file?

Actions #2

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.

I think, the best solution is, when
  1. the concatenation checks if the charset is on top. If not, move it to the top and remove duplicate definitions* and
  2. 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.

Actions #3

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.

Actions #4

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;}

Actions #5

Updated by Riccardo De Contardi about 9 years ago

  • Category set to Frontend
Actions #6

Updated by Riccardo De Contardi almost 9 years ago

  • Target version set to Candidate for patchlevel
Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Andreas Fernandez over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF