Documentation
¶
Index ¶
- Constants
- Variables
- func FileHandler(gen string) http.Handler
- func HTTPHandler(ctx *libsass.Context) func(w http.ResponseWriter, r *http.Request)
- func Init(handle io.Writer)
- func IsSass(r io.Reader) bool
- func LoadAndBuild(sassFile string, gba *BuildArgs, partialMap *SafePartialMap) error
- func ToScssReader(r io.Reader) (io.ReadCloser, error)
- type BuildArgs
- type Parser
- type Replace
- type Response
- type SafePartialMap
- type Watcher
Constants ¶
const MaxTopLevel int = 20
Sets the default size of the slice holding the top level files for a sass partial in SafePartialMap.M
Variables ¶
var ( // Debug future ability to toggle the logging level and destination. Debug *log.Logger )
Functions ¶
func FileHandler ¶ added in v0.7.0
FileHandler starts a file server serving files out of the specified build directory.
func HTTPHandler ¶ added in v0.7.0
HTTPHandler starts a CORS enabled web server that takes as input Sass and outputs CSS.
func IsSass ¶ added in v0.7.0
IsSass determines if the given reader is Sass (not Scss). This is predicted by the presence of semicolons
func LoadAndBuild ¶
func LoadAndBuild(sassFile string, gba *BuildArgs, partialMap *SafePartialMap) error
LoadAndBuild kicks off parser and compiling TODO: make this function testable
func ToScssReader ¶ added in v0.7.0
func ToScssReader(r io.Reader) (io.ReadCloser, error)
ToScssReader ...
Types ¶
type BuildArgs ¶
type BuildArgs struct {
Imgs, Sprites spritewell.SafeImageMap
Dir string
BuildDir string
Includes string
Font string
Gen string
Style int
Comments bool
}
BuildArgs holds universal arguments for a build that the parser uses during the initial build and the filewatcher passes back to the parser on any file changes.
func NewBuildArgs ¶ added in v0.7.0
func NewBuildArgs() *BuildArgs
NewBuildArgs creates a BuildArgs and initializes Cache maps for sprites and images
type Parser ¶
type Parser struct { Idx int Chop []Replace Pwd, Input, MainFile string SassDir, BuildDir, ProjDir string Imports libsass.Imports ImageDir string Includes []string Items []lexer.Item Output []byte Line map[int]string LineKeys []int PartialMap *SafePartialMap // contains filtered or unexported fields }
Parser represents a parser engine that returns parsed and imported code from the input useful for doing text manipulation before passing to libsass.
func StartParser ¶
func StartParser(ctx *libsass.Context, in io.Reader, out io.Writer, partialMap *SafePartialMap) (*Parser, error)
StartParser accepts build arguments TODO: Should this be called StartParser or NewParser? TODO: Should this function create the partialMap or is this the right way to inject one?
type Response ¶ added in v0.7.0
type Response struct { Contents string `json:"contents"` Start time.Time `json:"start"` Elapsed string `json:"elapsed"` Error string `json:"error"` }
Response is the object returned on HTTP responses from wellington
type SafePartialMap ¶
SafePartialMap is a thread safe map of partial sass files to top level files. The file watcher will detect changes in a partial and kick off builds for all top level files that contain that partial.
func NewPartialMap ¶
func NewPartialMap() *SafePartialMap
NewPartialMap creates a initialized SafeParitalMap with with capacity 100
func (*SafePartialMap) AddRelation ¶
func (p *SafePartialMap) AddRelation(mainfile string, subfile string)
AddRelation links a partial Sass file with the top level file by adding a thread safe entry into partialMap.M.
type Watcher ¶
type Watcher struct { FileWatcher *fsnotify.Watcher PartialMap *SafePartialMap Dirs []string BArgs *BuildArgs }
Watcher holds all data needed to kick off a build of the css when a file changes. FileWatcher is the object that triggers builds when a file changes. PartialMap contains a mapping of partials to top level files. Dirs contains all directories that have top level files. GlobalBuildArgs contains build args that apply to all sass files.
Directories
¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/wellington/go-libsass
Package context provides access to libsass For more info, see https://github.com/sass/libsass
|
Package context provides access to libsass For more info, see https://github.com/sass/libsass |
_workspace/src/gopkg.in/fsnotify.v1
Package fsnotify provides a platform-independent interface for file system notifications.
|
Package fsnotify provides a platform-independent interface for file system notifications. |
The lexer processes text flagging any sass extended commands sprite* as commands
|
The lexer processes text flagging any sass extended commands sprite* as commands |
Package token defines constants representing the lexical tokens of the Go programming language and basic operations on tokens (printing, predicates).
|
Package token defines constants representing the lexical tokens of the Go programming language and basic operations on tokens (printing, predicates). |
Main package wraps sprite_sass tool for use with the command line See -h for list of available options
|
Main package wraps sprite_sass tool for use with the command line See -h for list of available options |