Skip to content

Go集成lightgallery使用go-bindata打包html、css、js写的图片和视频浏览器

Notifications You must be signed in to change notification settings

Luo-Kuang/ImageView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageView

image

  • 集成lightgallery写的图片和视频浏览器
  • 使用go-bindata打包html、css、js
  • 使用ginweb服务器

使用

./ImageView

localhost:8888/image

bindata.go 是将静态文件打包成的*.go

index.go是程序入口

导入静态文件
fs := assetfs.AssetFS{
		Asset:     Asset,
		AssetDir:  AssetDir,
		AssetInfo: AssetInfo,
	}

	router := gin.Default()

	router.StaticFS("/static", &fs)
这段代码将打包的html文件供gin渲染
r := multitemplate.New()
	bytes, err := Asset("temp/oldindex.html")
	if err != nil {
		fmt.Println(err)
		return
	}
	t, err := template.New("index").Parse(string(bytes))
	fmt.Println(t, err)
	r.Add("index", t)
	router.HTMLRender = r
	router.GET("/image", func(c *gin.Context) {
		c.HTML(200, "index", gin.H{})
	})

lightgallery

jteeuwen/go-bindata

elazarl/go-bindata-assetfs

gin-gonic/gin

About

Go集成lightgallery使用go-bindata打包html、css、js写的图片和视频浏览器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published