Merge pull request #636 from trheyi/main
refactor: Add option to minify style code during SUI page build
This commit is contained in:
commit
23ea6c5e50
1 changed files with 8 additions and 2 deletions
|
|
@ -338,9 +338,7 @@ func (page *Page) BuildStyle(ctx *BuildContext, option *BuildOption) (string, er
|
|||
code = cssRe.ReplaceAllStringFunc(code, func(css string) string {
|
||||
return fmt.Sprintf("[s\\:cn=%s] %s", option.ComponentName, css)
|
||||
})
|
||||
}
|
||||
|
||||
res, err := page.CompileCSS([]byte(code), false)
|
||||
res, err := page.CompileCSS([]byte(code), option.StyleMinify)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
@ -349,6 +347,14 @@ func (page *Page) BuildStyle(ctx *BuildContext, option *BuildOption) (string, er
|
|||
return fmt.Sprintf("<style type=\"text/css\">\n%s\n</style>\n", res), nil
|
||||
}
|
||||
|
||||
res, err := page.CompileCSS([]byte(code), option.StyleMinify)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return fmt.Sprintf("<style type=\"text/css\">\n%s\n</style>\n", res), nil
|
||||
}
|
||||
|
||||
// BuildScript build the script
|
||||
func (page *Page) BuildScript(ctx *BuildContext, option *BuildOption, namespace string) (string, []string, error) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue