mirror of
https://github.com/kataras/iris.git
synced 2026-01-21 19:06:00 +00:00
Full support of the http.FileSystem on all view engines as requested at #1575
Also, the HandleDir accepts both string and http.FileSystem (interface{}) (like the view's fs)
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
||||
"github.com/kataras/iris/v12/view"
|
||||
)
|
||||
|
||||
// https://github.com/kataras/iris/issues/1443
|
||||
|
||||
func main() {
|
||||
|
||||
tmpl := iris.Jet("./views", ".jet")
|
||||
@@ -44,12 +42,12 @@ func (ViewBuiler) Asset(a view.JetArguments) reflect.Value {
|
||||
|
||||
func (ViewBuiler) Style(a view.JetArguments) reflect.Value {
|
||||
path := a.Get(0).String()
|
||||
s := fmt.Sprintf(`<link href="%v" rel="stylesheet"> `, path)
|
||||
s := fmt.Sprintf(`<link href="%v" rel="stylesheet">`, path)
|
||||
return reflect.ValueOf(s)
|
||||
}
|
||||
|
||||
func (ViewBuiler) Script(a view.JetArguments) reflect.Value {
|
||||
path := a.Get(0).String()
|
||||
s := fmt.Sprintf(`<script src="%v" ></script>`, path)
|
||||
s := fmt.Sprintf(`<script src="%v"></script>`, path)
|
||||
return reflect.ValueOf(s)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
{{ asset("./myasset.mp3")}}
|
||||
<br/>
|
||||
{{ style("my-stle.css")}}
|
||||
{{ style("my-stle.css") | raw}}
|
||||
<br/>
|
||||
{{ script("my-script.js")}}
|
||||
{{ script("my-script.js") | raw}}
|
||||
|
||||
<!-- view page source: can't add a link as chrome blocks loading local source, instead
|
||||
do that: -->
|
||||
|
||||
<code>
|
||||
./myasset.mp3
|
||||
<br/>
|
||||
<link href="my-stle.css" rel="stylesheet">
|
||||
<br/>
|
||||
<script src="my-script.js"></script>
|
||||
</code>
|
||||
Reference in New Issue
Block a user