mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
postcss: Fix import error handling
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import. You can work around this by either: * Use url imports or imports with media queries. * Set `skipInlineImportsNotFound=true` in the options Also get the argument order in the different NewFileError* funcs in line. Fixes #9895
This commit is contained in:
@@ -60,6 +60,7 @@ func TestShouldImport(t *testing.T) {
|
||||
{input: `@import 'navigation.css';`, expect: true},
|
||||
{input: `@import url("navigation.css");`, expect: false},
|
||||
{input: `@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,400i,800,800i&display=swap');`, expect: false},
|
||||
{input: `@import "printstyle.css" print;`, expect: false},
|
||||
} {
|
||||
c.Assert(imp.shouldImport(test.input), qt.Equals, test.expect)
|
||||
}
|
||||
@@ -88,12 +89,12 @@ A_STYLE2
|
||||
@import "b.css";
|
||||
LOCAL_STYLE
|
||||
@import "c.css";
|
||||
@import "e.css";
|
||||
@import "missing.css";`)
|
||||
@import "e.css";`)
|
||||
|
||||
imp := newImportResolver(
|
||||
mainStyles,
|
||||
"styles.css",
|
||||
Options{},
|
||||
fs, loggers.NewErrorLogger(),
|
||||
)
|
||||
|
||||
@@ -108,8 +109,7 @@ C_STYLE
|
||||
A_STYLE1
|
||||
A_STYLE2
|
||||
LOCAL_STYLE
|
||||
E_STYLE
|
||||
@import "missing.css";`)
|
||||
E_STYLE`)
|
||||
|
||||
dline := imp.linemap[3]
|
||||
c.Assert(dline, qt.DeepEquals, fileOffset{
|
||||
@@ -151,6 +151,7 @@ LOCAL_STYLE
|
||||
imp := newImportResolver(
|
||||
strings.NewReader(mainStyles),
|
||||
"styles.css",
|
||||
Options{},
|
||||
fs, logger,
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user