mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
1a8af7d4f0
commit
c7b6d74e89
2 changed files with 3 additions and 2 deletions
|
@ -76,7 +76,7 @@ func DecodeOptions(m map[string]interface{}) (opts Options, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
regularCSSImportTo = regexp.MustCompile(`.*(@import "(.*.css)";).*`)
|
regularCSSImportTo = regexp.MustCompile(`.*(@import "(.*\.css)";).*`)
|
||||||
regularCSSImportFrom = regexp.MustCompile(`.*(\/\* HUGO_IMPORT_START (.*) HUGO_IMPORT_END \*\/).*`)
|
regularCSSImportFrom = regexp.MustCompile(`.*(\/\* HUGO_IMPORT_START (.*) HUGO_IMPORT_END \*\/).*`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ func TestReplaceRegularCSSImports(t *testing.T) {
|
||||||
@import "regular.css";
|
@import "regular.css";
|
||||||
@import "moo";
|
@import "moo";
|
||||||
@import "another.css";
|
@import "another.css";
|
||||||
|
@import "foo.scss";
|
||||||
|
|
||||||
/* foo */`
|
/* foo */`
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ func TestReplaceRegularCSSImports(t *testing.T) {
|
||||||
|
|
||||||
res, replaced := replaceRegularImportsIn(scssWithImport)
|
res, replaced := replaceRegularImportsIn(scssWithImport)
|
||||||
c.Assert(replaced, qt.Equals, true)
|
c.Assert(replaced, qt.Equals, true)
|
||||||
c.Assert(res, qt.Equals, "\n\t\n@import \"moo\";\n/* HUGO_IMPORT_START regular.css HUGO_IMPORT_END */\n@import \"moo\";\n/* HUGO_IMPORT_START another.css HUGO_IMPORT_END */\n\n/* foo */")
|
c.Assert(res, qt.Equals, "\n\t\n@import \"moo\";\n/* HUGO_IMPORT_START regular.css HUGO_IMPORT_END */\n@import \"moo\";\n/* HUGO_IMPORT_START another.css HUGO_IMPORT_END */\n@import \"foo.scss\";\n\n/* foo */")
|
||||||
|
|
||||||
res2, replaced2 := replaceRegularImportsIn(scssWithoutImport)
|
res2, replaced2 := replaceRegularImportsIn(scssWithoutImport)
|
||||||
c.Assert(replaced2, qt.Equals, false)
|
c.Assert(replaced2, qt.Equals, false)
|
||||||
|
|
Loading…
Reference in a new issue