I have the following case.
All my mixins are declared in a separate file mixins.pug:
mixin pet(name='')
p.pet= name
And used in other parts of my templates. Like (nothing fancy here):
include mixins.pug
doctype html
html(lang='en')
head Test
body
+pet('Cat')
The problem is that mixins.pug is compiled into this go-code:
// Code generated by "jade.go"; DO NOT EDIT.
package pug
import (
"io"
)
const ()
func Jade_mixins(wr io.Writer) {
buffer := &WriterAsBuffer{wr}
}
And is causing a standard golang compilation error for such cases:
mixins.pug.go:12:2: buffer declared but not used
The only workaround is to add some no-op tag or an HTML comment into mixins.pug. But this introduces an unnecessary clutter in the resulting HTML code.
Is there a way to detect such cases upon generation and produce no-op code like _ = &WriterAsBuffer{wr} or simply skip generation of such container-files at all?
Hello,
I have the following case. All my mixins are declared in a separate file
mixins.pug
:And used in other parts of my templates. Like (nothing fancy here):
The problem is that
mixins.pug
is compiled into this go-code:And is causing a standard golang compilation error for such cases:
The only workaround is to add some no-op tag or an HTML comment into
mixins.pug
. But this introduces an unnecessary clutter in the resulting HTML code.Is there a way to detect such cases upon generation and produce no-op code like
_ = &WriterAsBuffer{wr}
or simply skip generation of such container-files at all?Thanks!