css

package
Version: v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2015 License: MIT Imports: 2 Imported by: 69

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Declaration

type Declaration struct {
	Property  string
	Value     string
	Important bool
}

Declaration represents a parsed style property

func NewDeclaration

func NewDeclaration() *Declaration

NewDeclaration instanciates a new Declaration

func (*Declaration) Equal

func (decl *Declaration) Equal(other *Declaration) bool

Equal returns true if both Declarations are equals

func (*Declaration) String

func (decl *Declaration) String() string

Returns string representation of the Declaration

func (*Declaration) StringWithImportant

func (decl *Declaration) StringWithImportant(option bool) string

StringWithImportant returns string representation with optional !important part

type DeclarationsByProperty

type DeclarationsByProperty []*Declaration

DeclarationsByProperty represents sortable style declarations

func (DeclarationsByProperty) Len

func (declarations DeclarationsByProperty) Len() int

Implements sort.Interface

func (DeclarationsByProperty) Less

func (declarations DeclarationsByProperty) Less(i, j int) bool

Implements sort.Interface

func (DeclarationsByProperty) Swap

func (declarations DeclarationsByProperty) Swap(i, j int)

Implements sort.Interface

type Rule

type Rule struct {
	Kind RuleKind

	// At Rule name (eg: "@media")
	Name string

	// Raw prelude
	Prelude string

	// Qualified Rule selectors parsed from prelude
	Selectors []string

	// Style properties
	Declarations []*Declaration

	// At Rule embedded rules
	Rules []*Rule

	// Current rule embedding level
	EmbedLevel int
}

Rule represents a parsed CSS rule

func NewRule

func NewRule(kind RuleKind) *Rule

NewRule instanciates a new Rule

func (*Rule) Diff

func (rule *Rule) Diff(other *Rule) []string

Diff returns a string representation of rules differences

func (*Rule) EmbedsRules

func (rule *Rule) EmbedsRules() bool

EmbedsRules returns true if this rule embeds another rules

func (*Rule) Equal

func (rule *Rule) Equal(other *Rule) bool

Equal returns true if both rules are equals

func (*Rule) String

func (rule *Rule) String() string

Returns the string representation of a rule

type RuleKind

type RuleKind int

RuleKind represents a Rule kind

const (
	QualifiedRule RuleKind = iota
	AtRule
)

Rule kinds

func (RuleKind) String

func (kind RuleKind) String() string

Returns string representation of rule kind

type Stylesheet

type Stylesheet struct {
	Rules []*Rule
}

Stylesheet represents a parsed stylesheet

func NewStylesheet

func NewStylesheet() *Stylesheet

NewStylesheet instanciate a new Stylesheet

func (*Stylesheet) String

func (sheet *Stylesheet) String() string

Returns string representation of the Stylesheet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL