October CMS resources and help articles

Simple and to the point. Optimized by the community.

Include jQuery in your project

by OFFLINE, last modified on August 10th, 2019

You can include the same jQuery version October ships in your theme by using the @jquery alias.

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

By passing it as an array to the | theme filter you'll get a new filename as soon as the content of the jQuery file changes. This makes sure that users will download the new version and not use a cached one.

You can also add additional files to the array to combine all of them into a single output file.

<script src="{{ ['@jquery', 'assets/another.js'] | theme }}"></script>



Post on February 17th, 2021 3:31 PM

Google Lighthouse test doesn't like the jQuery delivered with OctoberCMS as it seems to be too old... :(

Post on June 2nd, 2023 4:47 AM

Hi, can you do something like this with bootstrap too? I tried <link href="{{ ['@bootstrap'] | theme }}" rel="stylesheet"> but it didn't work. Thanks

We use cookies to measure the performance of this website. Do you want to accept these cookies?