f128c947ab
* Refactor plugin to be compatible with Drone 0.5 * Add vendor files * Re-add logo.svg, make loading environment from .env file optional, and use drone-go/template * Fix README * Fix issue with date formatting, update the DOCS, and improve types * Add working directory and volume mount to README example
27 lines
649 B
Go
27 lines
649 B
Go
package inliner
|
|
|
|
import "github.com/aymerick/douceur/css"
|
|
|
|
// StyleDeclaration represents a style declaration
|
|
type StyleDeclaration struct {
|
|
StyleRule *StyleRule
|
|
Declaration *css.Declaration
|
|
}
|
|
|
|
// NewStyleDeclaration instanciates a new StyleDeclaration
|
|
func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration {
|
|
return &StyleDeclaration{
|
|
StyleRule: styleRule,
|
|
Declaration: declaration,
|
|
}
|
|
}
|
|
|
|
// Specificity computes style declaration specificity
|
|
func (styleDecl *StyleDeclaration) Specificity() int {
|
|
if styleDecl.Declaration.Important {
|
|
return 10000
|
|
}
|
|
|
|
return styleDecl.StyleRule.Specificity
|
|
}
|