Disabling file compression in TYPO3 'be:container'

680 Views Asked by At

I've been working around with the development of a TYPO3 extension. While designing the backend module I'd observed that my css and js external files which are included with,

<f:be.container loadJQuery="true" includeCssFiles="{0:'https://ajax.googleapis.com/****'}" includeJsFiles="{0:'https://ajax.googleapis.com/****'}" >

are getting compressed and as a result the design turning into a mess. Compressing is a good act. I admit it. But how can avoid it in backend container or at least for external files.. ?? Wandering for the answer for 2 days.

1

There are 1 best solutions below

0
On BEST ANSWER

From the code this is not easily possible with the be.container view helper (as it calls $pageRenderer->addCssFile directly, without options).

What you could do would be to add an own viewhelper exposing all the addCssFile options. As an example, your viewhelper could look like this:

class AddCssFileViewHelper extends AbstractViewHelper
{
    /**
     * @var PageRenderer
     */
    protected $pageRenderer;

    /**
     * @param PageRenderer $pageRenderer
     */
    public function injectPageRenderer(PageRenderer $pageRenderer)
    {
        $this->pageRenderer = $pageRenderer;
    }

    /**
     * Initialize arguments.
     *
     * @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception 
     */
    public function initializeArguments()
    {
        parent::initializeArguments();
        $this->registerArgument('cssFile', 'string', 'path to your file', false, '');
        $this->registerArgument('compress', 'bool', 'specifies whether to compress or not, default: true', false, true);

    }


    public function render()
    {
        $this->pageRenderer->addCssFile($this->arguments['cssFile'], 'stylesheet', 'all', '', $this->arguments['compress']);
    }
}