mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
@@ -14,6 +14,8 @@
|
||||
package scss
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/gohugoio/hugo/hugolib/filesystems"
|
||||
"github.com/gohugoio/hugo/resources"
|
||||
@@ -72,3 +74,17 @@ func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
regularCSSImportTo = regexp.MustCompile(`.*(@import "(.*.css)";).*`)
|
||||
regularCSSImportFrom = regexp.MustCompile(`.*(\/\* HUGO_IMPORT_START (.*) HUGO_IMPORT_END \*\/).*`)
|
||||
)
|
||||
|
||||
func replaceRegularImportsIn(s string) (string, bool) {
|
||||
replaced := regularCSSImportTo.ReplaceAllString(s, "/* HUGO_IMPORT_START $2 HUGO_IMPORT_END */")
|
||||
return replaced, s != replaced
|
||||
}
|
||||
|
||||
func replaceRegularImportsOut(s string) string {
|
||||
return regularCSSImportFrom.ReplaceAllString(s, "@import \"$2\";")
|
||||
}
|
||||
|
Reference in New Issue
Block a user