Project

General

Profile

Actions

Bug #53123

closed

Is compressing external JS and CSS files necessary by default?

Added by Artur Cichosz about 11 years ago. Updated over 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

Also available in: Atom PDF