diff options
| author | Bobby <[email protected]> | 2026-01-20 14:02:34 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-01-20 14:02:34 +0530 |
| commit | 7fee36b4fbae90dacdecb917e262ad58927fe746 (patch) | |
| tree | 3739af9bf8d2e78c6536a7dfa24ce391abb90ff1 /tags/static.go | |
| parent | 61d5f45189a40621bceeb14c6646031dd15ab6c2 (diff) | |
| download | cafe-7fee36b4fbae90dacdecb917e262ad58927fe746.tar.xz cafe-7fee36b4fbae90dacdecb917e262ad58927fe746.zip | |
Add Tailwind CSS and HTMX integration and implement custom template tags
Diffstat (limited to 'tags/static.go')
| -rw-r--r-- | tags/static.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tags/static.go b/tags/static.go new file mode 100644 index 0000000..253fa9c --- /dev/null +++ b/tags/static.go @@ -0,0 +1,25 @@ +package tags + +import ( + "github.com/flosch/pongo2/v6" +) + +type tagStaticNode struct { + path string +} + +func static(_ *pongo2.Parser, _ *pongo2.Token, arguments *pongo2.Parser) (pongo2.INodeTag, *pongo2.Error) { + pathToken := arguments.MatchType(pongo2.TokenString) + if pathToken == nil { + return nil, arguments.Error("Expected a string path", nil) + } + + return &tagStaticNode{ + path: pathToken.Val, + }, nil +} + +func (node *tagStaticNode) Execute(ctx *pongo2.ExecutionContext, writer pongo2.TemplateWriter) *pongo2.Error { + writer.WriteString("/static/" + node.path) + return nil +} |
