How can I compress my js/css files in TYPO3
Asked Answered
A

2

10

how can I compress (minify) my JavaScript and CSS files dynamically in TYPO3?

Thanks

Arrivederci answered 14/2, 2011 at 12:17 Comment(0)
E
2

I suggest using the scriptmerger extension. It automatizes this task for you.

Essentiality answered 14/2, 2011 at 13:14 Comment(2)
why an extension, while TYPO3 provides inbuilt support for compression ??Gourmet
Because some of those extensions are better (read: more effective, more features). Disclaimer: I contributed parts of the core implementation.Essentiality
E
32

You could use Typoscript (since 4.6):

config {
  concatenateJs = 1
  concatenateCss = 1

  compressJs = 1
  compressCss = 1
}

page {
  includeJS {
    myFile1 = fileadmin/js_file1.js

    myFile2 = fileadmin/js_file2.js
    myFile2.excludeFromConcatenation = 1
  }

  includeCSS {
    myFile1 = fileadmin/css_file1.css

    myFile2 = fileadmin/css_file2.css
    myFile2.disableCompression = 1
  }
}

See the TSref documentation

Elenoraelenore answered 5/4, 2012 at 10:19 Comment(1)
Link is dead...Gambia
E
2

I suggest using the scriptmerger extension. It automatizes this task for you.

Essentiality answered 14/2, 2011 at 13:14 Comment(2)
why an extension, while TYPO3 provides inbuilt support for compression ??Gourmet
Because some of those extensions are better (read: more effective, more features). Disclaimer: I contributed parts of the core implementation.Essentiality

© 2022 - 2024 — McMap. All rights reserved.