I know I only use it load the one template file, this is why I don't use
partials or a main layout.

Able to reference external CSS, JS files would be quite useful. Is there
any way to solve this? This seems like a very important feature which not
yet implemented into gomobile.

Here is a test file, without pongo2 rendering. This is how I call my
template:

func test(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")

a, err := asset.Open("test.html")
if err != nil {
fmt.Fprintf(w, "could not execute: %v\n", err)
}
defer a.Close()

b, err := ioutil.ReadAll(a)
if err != nil {
fmt.Fprintf(w, "could not execute: %v\n", err)
}
fmt.Fprintf(w, "File contents: %s\n", b)
}

2017-08-29 19:21 GMT+02:00 Egon <egonel...@gmail.com>:

> AFAIR asset.Open doesn't support folders.
>
>
> On Tuesday, 29 August 2017 20:06:34 UTC+3, Lantos István wrote:
>>
>> I created a gomobile app with the bind command. The `Main.java` app
>> embedding the go webserver into webview.
>>
>> I placed my css file in `./src/main/assets/css/main.css` location. I
>> referencing in the template file with:
>>
>> <link rel="stylesheet" href="file:///android_asset/css/main.css">
>>
>> But it's not showing up. The background should be red. I discovered
>> `asset.Open` which I use to read a single pongo2 template file into the Mux
>> router. I tried including partials, but realised I needed to somehow
>> monkey-patch pongo2 able to load the other template files also, which I
>> don't know how to do. Is there an option in `gomobile` able to load the
>> assets? I can deal with it if pongo2 not able to include another templates.
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/golang-nuts/HGYpl91m9go/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to