Project

General

Profile

Actions

Bug #53123

closed

Is compressing external JS and CSS files necessary by default?

Added by Artur Cichosz over 10 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Could have
Assignee:
Category:
Frontend
Target version:
-
Start date:
2013-10-25
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I didn't make use of JS / CSS compressor to much, so I didn't notice the problem until now, where I have some external CSS/JS files included and compressor activated at the same time.

The compressor tries to compress the external file and store it locally but fails to do so properly.
I get the following Error in the frontend:

Warning: filemtime(): stat failed for /srv/.../trunk/typo3/http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css in /srv/www/htdocs/typo3_src/6.0.10/typo3/sysext/core/Classes/Resource/ResourceCompressor.php on line 367

Anyway I do not think it's necessary to compress external files at all, since it is against the general idea of using CDN networks.

Of course there is the possibility to switch off compression for a file explicitly using includeJS.[key].disableCompression.
But I think it would be better to make "not compressing" external files the default behavior and to give the posibility to enable it explicitly if desired.

In my case I extended the class \TYPO3\CMS\Frontend\Page\PageGenerator and made some changes, where includeJS, includeCSS, includeJSFooter, includeJSLibs and includeJSLibsFooter are processed, making each time a change similar to the following:

/**
 * Modified by Quintinity - Start
 * prevent from compressing external files
 */
$pageRenderer->addCssFile($ss, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['alternate'] ? 'alternate stylesheet' : 'stylesheet', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['media'] : 'all', $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] ? $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['title'] : '', empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['disableCompression']) && empty($GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['external']), $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['forceOnTop'] ? TRUE : FALSE, $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['allWrap'], $GLOBALS['TSFE']->pSetup['includeCSS.'][$key . '.']['excludeFromConcatenation'] ? TRUE : FALSE);
// Modified By Quintinity - Stop


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #29695: t3lib_Compressor fails with external filesClosedXavier Perseguers2011-09-12

Actions
Related to TYPO3 Core - Bug #87861: config.compressCss prevents inclusion of external filesClosed2019-03-07

Actions
Actions #1

Updated by Philipp Gampe over 10 years ago

  • Status changed from New to Needs Feedback

I agree with you. Browsers will cache contents (idea of CDN) and therefor it does not make any sense to compress a file locally*.

  • It could make sense on mobile optimized sites that want to save open TCP connections, however I do not think that this wins more performance that a cached file from a CDN.
Actions #2

Updated by Alexander Opitz about 10 years ago

  • Priority changed from -- undefined -- to Could have
  • Target version deleted (6.0.9)

In http://wiki.typo3.org/TYPO3_4.6#JS.2FCSS_Compression is described how to exclude such files. Does this help you?

Actions #3

Updated by Artur Cichosz about 10 years ago

I know this already, see "Of course there is the possibility to switch off compression for a file explicitly using includeJS.[key].disableCompression.".
I do only think it could be better to change the default behaviour.

Actions #4

Updated by Alexander Opitz about 10 years ago

  • Status changed from Needs Feedback to New

Ok, so I misread it yesterday.

Actions #5

Updated by Riccardo De Contardi over 8 years ago

  • Category set to Frontend
Actions #6

Updated by Gerrit Code Review over 5 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/58867

Actions #7

Updated by Gerrit Code Review over 5 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/58867

Actions #8

Updated by Benjamin Kott over 5 years ago

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

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions #10

Updated by Georg Ringer about 4 years ago

  • Related to Bug #87861: config.compressCss prevents inclusion of external files added
Actions

Also available in: Atom PDF