ext_prepend

Inserts an extra extension segment just before the existing file extension, so 'styles.css' with 'min' becomes 'styles.min.css'.

The inserted segment is taken literally and should not include a leading dot, since the dots are added for you. When the path has no extension, the segment is appended as a new extension ("noext" becomes "noext.min"). Only the final extension is considered, so "archive.tar.gz" becomes "archive.tar.min.gz".

InputArgumentsReturnsstringstringstring
Source
BasicSource

Inserts an extra extension segment just before the existing extension, so a minified name keeps its original suffix.

Given

{"path": "styles.css"}

Template

{{ path | ext_prepend:'min' }}

Result

styles.min.css
Directory pathSource

Keeps the directory portion intact while rewriting only the final filename's extension.

Given

{"path": "public/site/index.html"}

Template

{{ path | ext_prepend:'en' }}

Result

public/site/index.en.html
Multi extensionSource

Inserts the segment before only the final extension, leaving earlier suffixes in place.

Given

{"path": "archive.tar.gz"}

Template

{{ path | ext_prepend:'bak' }}

Result

archive.tar.bak.gz
No extensionSource

Appends the segment as a new extension when the path has none to begin with.

Given

{"path": "backup"}

Template

{{ path | ext_prepend:'tmp' }}

Result

backup.tmp