Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MatchDefault = func(fn string) bool { ext := strings.ToLower(filepath.Ext(fn)) switch ext { case ".html", ".vugu", ".jsx", ".vue": return true } return false }
MatchDefault is a filename matcher function which will return true for files end in .html, .vugu, .jsx or .vue.
Functions ¶
func PurgeKeysFromDist ¶
FIXME: this should probably be called RuleNamesFromDist, and document the idea of "rule names" vs "purge keys". PurgeKeysFromDist runs PurgeKeysFromReader on the appropriate(s) file from the dist. A check is done to see if Dist implements interface { PurgeKeyMap() map[string]struct{} } and this is used if avialable. Otherwise the appropriate files(s) are processed from the dist using PurgeKeysFromReader.
Types ¶
type Checker ¶
Checker is implemented by something that can answer the question "should this CSS rule be purged from the output because it is unused".
type DefaultTokenizer ¶
type DefaultTokenizer struct {
// contains filtered or unexported fields
}
DefaultTokenizer implements Tokenizer with a sensible default tokenization.
func NewDefaultTokenizer ¶
func NewDefaultTokenizer(r io.Reader) *DefaultTokenizer
func (*DefaultTokenizer) NextToken ¶
func (t *DefaultTokenizer) NextToken() ([]byte, error)
type Dist ¶
type Dist interface {
OpenDist(name string) (io.ReadCloser, error)
}
Dist matches tailwind.Dist
type Map ¶
type Map map[string]struct{}
Map is a set of strings that implements Checker. The output of a Scanner is a Map that can be used to during conversion to rapidly check if a style rule needs to be output.
func (Map) ShouldPurgeKey ¶
ShouldPurgeKey implements Checker.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner scans through textual files (generally HTML-like content) and looks for tokens to be preserved when purging. The scanning is intentionally naive in order to keep it's rules simple to understand and reasonbly performant. (TODO: explain more)