TransWikia.com

CSS and JS tags with custom version parameter

Craft CMS Asked by Killerpixler on April 11, 2021

When using {% css '/path/to/file.css' %} craft adds a v= query parameter by itself so that it comes out like this:

<link href="/path/to/file.css?v=1612895916" rel="stylesheet">

I can’t find anything in the craft docs about changing this or making it something custom. The docs for css only states that

To register a CSS file, the URL must end in .css.

For various reasons I need to attach a couple of other url parameters to the generated link tag.

I know I could write the link tag myself and use twig in the href but I would like to take advantage of craft de-duplicating if the same css/js file is included multiple times. Likewise going the {{tag('link', {href:....)}} route would also not de-dupe if the tag was added multiple times.

Any idea on how to use a custom set of URL parameters?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP