Version: v0.3.3 Latest Latest

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

Go to latest
Published: Aug 2, 2018 License: MIT Imports: 9 Imported by: 0




This section is empty.


This section is empty.


func ComputeSpecificity

func ComputeSpecificity(selector string) int

ComputeSpecificity computes style rule specificity


func Inlinable

func Inlinable(selector string) bool

Inlinable returns true if given selector is inlinable

func Inline

func Inline(html string) (string, error)

Inline inlines css into html document


type Element

type Element struct {
	// contains filtered or unexported fields

Element represents a HTML element with matching CSS rules

func NewElement

func NewElement(elt *goquery.Selection) *Element

NewElement instanciates a new element

type ElementAttr

type ElementAttr struct {
	// contains filtered or unexported fields

ElementAttr represents a HTML element attribute

type Inliner

type Inliner struct {
	// contains filtered or unexported fields

Inliner presents a CSS Inliner

func NewInliner

func NewInliner(html string) *Inliner

NewInliner instanciates a new Inliner

func (*Inliner) Inline

func (inliner *Inliner) Inline() (string, error)

Inline inlines CSS and returns HTML

func (*Inliner) InlineAttributes added in v0.3.2

func (inliner *Inliner) InlineAttributes(val bool)

InlineAttributes sets if the inliner should inline attributes

func (*Inliner) ParseStylesheet added in v0.3.2

func (inliner *Inliner) ParseStylesheet(s string) error

ParseStylesheet parses a stylesheet for inlining.

type StyleDeclaration

type StyleDeclaration struct {
	StyleRule   *StyleRule
	Declaration *css.Declaration

StyleDeclaration represents a style declaration

func NewStyleDeclaration

func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration

NewStyleDeclaration instanciates a new StyleDeclaration

func (*StyleDeclaration) Specificity

func (styleDecl *StyleDeclaration) Specificity() int

Specificity computes style declaration specificity

type StyleRule

type StyleRule struct {
	// The style rule selector
	Selector string

	// The style rule properties
	Declarations []*css.Declaration

	// Selector specificity
	Specificity int

StyleRule represents a Qualifier Rule for a uniq selector

func NewStyleRule

func NewStyleRule(selector string, declarations []*css.Declaration) *StyleRule

NewStyleRule instanciates a new StyleRule

func (*StyleRule) String

func (styleRule *StyleRule) String() string

Returns the string representation of a style rule

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