October: Minify framework js code

Created on 14 Sep 2020  路  4Comments  路  Source: octobercms/october

Can framework js code be minified?
https://www.octobercms.com/modules/system/assets/js/framework.js
https://www.octobercms.com/modules/system/assets/js/framework.extras.js

Google insigt or gtmetrix alerts that this code is not compressed

Question

All 4 comments

Yes, pass them to an array and use the theme filter. Something like this should work:

<script src="{{ [
            '@jquery',
            '@framework',
            '@framework.extras'
        ]|theme }}"></script>

Reference is also in the docs.

This code only combine assets.

From the docs:

Note: You can enable the assets minification with the enableAssetMinify parameter in the config/cms.php script. By default the minification is disabled.

@alxy is correct - cms.enableAssetMinify will minify scripts that are run through the combiner, using the code he mentioned above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SeekAndPwn picture SeekAndPwn  路  3Comments

jvanremoortere picture jvanremoortere  路  3Comments

axomat picture axomat  路  3Comments

m49n picture m49n  路  3Comments

EbashuOnHolidays picture EbashuOnHolidays  路  3Comments