Documentation
¶
Index ¶
- Constants
- Variables
- func FileHandler(gen string) http.Handler
- func FromBuildArgs(dst io.Writer, src io.Reader, gba *BuildArgs) (libsass.Compiler, error)
- func HTTPHandler(gba *BuildArgs, httpPath string) func(w http.ResponseWriter, r *http.Request)
- func Init(handle io.Writer)
- func IsSass(r io.Reader) bool
- func LoadAndBuild(path string, gba *BuildArgs, pMap *SafePartialMap) error
- func ToScssReader(r io.Reader) (io.ReadCloser, error)
- type Build
- type BuildArgs
- type Parser
- type Replace
- type Response
- type SafePartialMap
- type WatchOptions
- type Watcher
Examples ¶
Constants ¶
const MaxTopLevel int = 20
MaxTopLevel 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 )
var ErrPartialMap = errors.New("No partial map found")
ErrPartialMap when no partial map is found
Functions ¶
func FileHandler ¶ added in v0.7.0
FileHandler starts a file server serving files out of the specified build directory.
func FromBuildArgs ¶ added in v1.0.0
FromBuildArgs creates a compiler from BuildArgs
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(path string, gba *BuildArgs, pMap *SafePartialMap) error
LoadAndBuild kicks off parser and compiling. It expands directories to recursively locate Sass files TODO: make this function testable
func ToScssReader ¶ added in v0.7.0
func ToScssReader(r io.Reader) (io.ReadCloser, error)
ToScssReader ...
Types ¶
type Build ¶ added in v1.0.0
type Build struct {
// contains filtered or unexported fields
}
Build holds a set of read only arguments to the builder. Channels from this are used to communicate between the workers and loaders executing builds.
func NewBuild ¶ added in v1.0.0
func NewBuild(paths []string, args *BuildArgs, pMap *SafePartialMap) *Build
NewBuild accepts arguments to reate a new Builder
Example ¶
ps := []string{"test/sass/file.scss"}
b := NewBuild(ps,
&BuildArgs{paths: ps}, NewPartialMap())
err := b.Run()
if err != nil {
log.Fatal(err)
}
Output: div { color: black; }
type BuildArgs ¶
type BuildArgs struct {
// Imgs, Sprites spritewell.SafeImageMap
Payload types.Payloader
ImageDir string
// BuildDir is the base build directory used. When recursive
// file matching is involved, this directory will be used as the
// parent.
BuildDir string
Includes []string
Font string
Gen string
Style int
Comments bool
// contains filtered or unexported fields
}
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.
type Parser ¶
type Parser struct {
Idx int
Chop []Replace
Pwd, Input, MainFile string
SassDir, BuildDir,
ProjDir string
Imports libsass.Imports
ImageDir string
Includes []string
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.
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"`
Version string `json:"version"`
}
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) Add ¶ added in v1.0.1
func (p *SafePartialMap) Add(key string, paths []string)
Add places a path in the partial map
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 WatchOptions ¶ added in v1.0.0
type WatchOptions struct {
PartialMap *SafePartialMap
Paths []string
BArgs *BuildArgs
}
WatchOptions containers the necessary parameters to run the file watcher
func NewWatchOptions ¶ added in v1.0.0
func NewWatchOptions() *WatchOptions
NewWatchOptions returns a new WatchOptions
type Watcher ¶
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.
func NewWatcher ¶
func NewWatcher(opts *WatchOptions) (*Watcher, error)
NewWatcher returns a new watcher pointer
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Godeps
|
|
|
_workspace/src/github.com/fatih/color
Package color is an ANSI color package to output colorized or SGR defined output to the standard output.
|
Package color is an ANSI color package to output colorized or SGR defined output to the standard output. |
|
_workspace/src/github.com/mattn/go-isatty
Package isatty implements interface to isatty
|
Package isatty implements interface to isatty |
|
_workspace/src/github.com/shiena/ansicolor
Package ansicolor provides color console in Windows as ANSICON.
|
Package ansicolor provides color console in Windows as ANSICON. |
|
_workspace/src/github.com/shiena/ansicolor/ansicolor
command
The ansicolor command colors a console text by ANSI escape sequence like wac.
|
The ansicolor command colors a console text by ANSI escape sequence like wac. |
|
_workspace/src/github.com/spf13/cobra
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
|
Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. |
|
_workspace/src/github.com/spf13/pflag
pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
|
pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. |
|
_workspace/src/github.com/wellington/go-libsass
Package context wraps access to libsass.
|
Package context wraps access to libsass. |
|
_workspace/src/github.com/wellington/go-libsass/libs
libs is a direct mapping to libsass C API.
|
libs is a direct mapping to libsass C API. |
|
_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. |
|
examples
|
|
|
basic
command
|
|
|
stress
command
|
|
|
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 |

