If you inspect the browser console, are you serving the bootstrap css ??

I normally do something like this:
mux.Handle("/assets/", http.StripPrefix("/assets/",
http.FileServer(http.Dir("./assets"))))

And then my css link will be  /assets/bootstrap/css/bootstrap.min.css
where 'assets' is my public folder.


On Tue, Jul 12, 2016 at 6:57 AM, <babs...@gmail.com> wrote:

> i have been having major issues making bootstrap style reflect on my
> html/template output and i'm wondering if there's any other way to go about
> this. my code below
> INDEX.HTML
>
>         {{define "head"}}<title>Dead Or Injured</title>
>         <meta charset="utf-8">
>         <meta http-equiv="X-UA-Compatible" content="IE=edge">
>         <meta name="viewport" content="width=device-width,
> initial-scale=1">
>
>         <!-- Bootstrap -->
>         <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
>         {{end}}
>
>         {{define "body"}}
>         <form action="/game/submit" method="post" role="form">
>         <div class="form-group">
>         <p>Input your guess: <input type="text" name="guess"/></p>
>         <button type="submit" value="submit" class="btn
> btn-default">Submit</button>
>         </div>
>         </form>
>
>
>         <fieldset>
>         {{range .}}
>         <p>
>         {{.}}
>         </p>
>         {{end}}
>         </fieldset>
>
>         {{end}}
>
> And this is BASE.HTML
>
>         {{define "base"}}
>         <html>
>         <head>{{template "head" .}}</head>
>         <body>{{template "body" .}}</body>
>         </html>
>         {{end}}
>
> index.html and base.html are in the same folder so i don't think the
> folder structure is a problem except you think otherwise.
> Here's main.go
>         func main() {
>    mongo.GetSession()
>
>    r := mux.NewRouter().StrictSlash(false)
>    fs := http.FileServer(http.Dir("public"))
>    r.Handle("/public/", fs)
>    r.HandleFunc("/", gamePage)
>    r.HandleFunc("/game/submit", functions.Submit)
>    r.HandleFunc("/game/highscoreinput", scoreInputPage)
>    r.HandleFunc("/game/postUser", mongo.PostUser)
>    r.HandleFunc("/game/highscores", mongo.RetrieveUsers)
>
>    server := &http.Server{
>    Addr:    ":8080",
>    Handler: r,
>    }
>    log.Println("Listening...")
>    server.ListenAndServe()
>         }
>
> After all these, the template works fine and all the pnly bit remaining is
> for it to shake off the boring interface and make use of the bootstrap
> provided. Thanks.
>
> --
> 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.
>

-- 
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