static

package
v5.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package static 提供了对 docs 中内容的处理方式

Index

Constants

View Source
const (
	TypeNone = iota
	TypeAll
	TypeStylesheet
)

几种文件类型的定义

Variables

This section is empty.

Functions

func EmbeddedHandler

func EmbeddedHandler(data []*FileInfo) http.Handler

EmbeddedHandler 将由 Pack 打包的内容当作一个文件服务中间件

func FolderHandler

func FolderHandler(folder string, t Type) http.Handler

FolderHandler 将 folder 当作文件服务中间件

func Pack

func Pack(root, pkgName, varName, path string, t Type, addTo ...*FileInfo) error

Pack 打包 root 目录下的内容到 path 文件

root 需要打包的目录; pkgName 输出的包名; varName 输出的变量名; path 内容保存的文件名; t 打包的文件类型,如果为 TypeNone,则只打包 addTo 的内容; addTo 追加的打包内容;

Types

type FileInfo

type FileInfo struct {
	// 相对于打包根目录的地址,同时也会被作为路由地址
	Name string

	ContentType string
	Content     []byte
}

FileInfo 被打包文件的信息

type Type

type Type int8

Type 表示文件的类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL