Documentation
¶
Overview ¶
Contains Spriter struct to generate css sprite by scanning css file, generate updated css file. For standalone command line utility, see css/cmd/sprite package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service interface { // OpenImage opens image file as io.Reader, path is the relative path defined // in css. Spriter will close the io.Reader if it also implements io.Closer. OpenImage(path string) (io.Reader, error) // Create sprite image file return as io.Writer. Spriter will close the // io.Writer if it also implements io.Closer. path is relative to output css // file. CreateSpriteImage(path string) (io.Writer, error) }
Service provide/isolate I/O interface of Spriter.
func NewFileService ¶
Create a Service work with file system.
srcPaths: Base path used to resolve image files referenced in css. Normally it is the directory where src .css file is. Can be multiple path, if the .img not exist in 1st path, search it in next path. outPath: Base path used to resolve generated sprite image files. Normally it is the diretory where out .css file is.
type Spriter ¶
type Spriter struct {
// contains filtered or unexported fields
}
Generate css sprite image by scan .css file, generate updated .css file.
Image must use relative path, absolute path or other web site report as warning.
Only png file supported, ignore other image file format.
Image file name need to be in [Group].[Name].png format, images with the same group name will generate a sprite image [Group].png. Images without group name leave it untouched.