获取min.css 和 min.js时,Content-Type始终为 `text/html`
以下为代码
<head>
<title>所有文章 —— 我的技术博客</title>
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/app.css" rel="stylesheet">
</head>
.
.
.
</div>
<script src="/js/bootstrap.min.js"></script>
</body>
package routes
import (
"github.com/attitudefx7/goblog/app/http/controllers"
"github.com/gorilla/mux"
"net/http"
)
func RegisterWehRoutes(r *mux.Router) {
// 静态资源
r.PathPrefix("/css/").Handler(http.FileServer(http.Dir("./public")))
r.PathPrefix("/js/").Handler(http.FileServer(http.Dir("./public")))
//r.Use(middlewares.ForceHTML)
}
推荐文章: