# README
Combine
Package combine provides interface to create assets with multiple source of contents (bytes, string, file path or URL). It combines and minifies them on the fly on the first demand on the dedicated file server.
Installation
$ go get github.com/rvflash/combine
$ cd $GOPATH/src/github.com/rvflash/combine
$ dep ensure
Usage
See example for real usage. Errors are ignored for the demo.
import "github.com/rvflash/combine"
// ...
// Creates a box with the path to the local file resources
// and the path to store combined / minified assets.
static := combine.NewBox("./src", "./combine")
// Deletes all files cache on exit.
defer func() { _ = static.Close() }()
// ...
// Creates a asset.
css := static.NewCSS()
_ = css.AddURL("https://raw.githubusercontent.com/twbs/bootstrap/v4-dev/dist/css/bootstrap-reboot.css")
_ = css.AddString(".blue{ color: #4286f4; }")
_ = css.AddFile("local/file/is_src_dir.css")
// Uses it in a HTML template by retrieving its path or tag.
// By default, a build version will also added.
tag := css.Tag("/static/")
// ...
// Serves combined and minifed resousrces
http.Handle("/static/", http.FileServer(static))
http.ListenAndServe(":8080", nil)
# Packages
No description provided by the author
# Functions
NewBox returns a new instance of Box.
# Variables
ErrExist is returned when asset already exists.
ErrMime is returned ii the mime type is not managed.
ErrNotFound is returned ii the asset is not found.
ErrUnexpectedEOF means that the asset is empty.
# Interfaces
Aggregator is the interface implemented by asset to add content inside.
Combiner must be implement to combine minified contents.
File ...
HTTPGetter represents the mean to get data from HTTP.
StringCombiner ...
Tagger must be implemented by an asset to be used in HTML5.
# Type aliases
Dir defines the current workspace.