ext_dot

Returns the file extension including the leading dot, for example '.png' for 'avatar.png'.

It is the counterpart to FilenameExt for callers rebuilding a name that need the separator kept, so a name with no dot yields "".

InputArgumentsReturnsstringno argumentsstring
Source
BasicSource

Returns the file extension including the leading dot, the counterpart to ext for callers rebuilding a name.

Given

{"path": "avatar.png"}

Template

{{ path | ext_dot }}

Result

.png
CompoundSource

Keeps the separator on the final extension of a compound name.

Given

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

Template

{{ path | ext_dot }}

Result

.gz
Full pathSource

Reads the dotted extension from the final element of a multi-segment path, ready to append when rebuilding a name.

Given

{"path": "assets/img/logo.svg"}

Template

{{ path | ext_dot }}

Result

.svg