diff options
Diffstat (limited to 'resources/resource_transformers/tocss')
-rw-r--r-- | resources/resource_transformers/tocss/scss/client.go | 3 | ||||
-rw-r--r-- | resources/resource_transformers/tocss/scss/tocss.go | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/resources/resource_transformers/tocss/scss/client.go b/resources/resource_transformers/tocss/scss/client.go index 41ff67433..e69af2f74 100644 --- a/resources/resource_transformers/tocss/scss/client.go +++ b/resources/resource_transformers/tocss/scss/client.go @@ -19,6 +19,7 @@ import ( "github.com/gohugoio/hugo/hugolib/filesystems" "github.com/gohugoio/hugo/resources" "github.com/gohugoio/hugo/resources/resource" + "github.com/spf13/afero" "github.com/mitchellh/mapstructure" ) @@ -26,7 +27,7 @@ import ( type Client struct { rs *resources.Spec sfs *filesystems.SourceFilesystem - workFs *filesystems.SourceFilesystem + workFs afero.Fs } func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) { diff --git a/resources/resource_transformers/tocss/scss/tocss.go b/resources/resource_transformers/tocss/scss/tocss.go index 17c32ea8e..ad581d681 100644 --- a/resources/resource_transformers/tocss/scss/tocss.go +++ b/resources/resource_transformers/tocss/scss/tocss.go @@ -55,7 +55,11 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx // Append any workDir relative include paths for _, ip := range options.from.IncludePaths { - options.to.IncludePaths = append(options.to.IncludePaths, t.c.workFs.RealDirs(filepath.Clean(ip))...) + info, err := t.c.workFs.Stat(filepath.Clean(ip)) + if err == nil { + filename := info.(hugofs.FileMetaInfo).Meta().Filename() + options.to.IncludePaths = append(options.to.IncludePaths, filename) + } } // To allow for overrides of SCSS files anywhere in the project/theme hierarchy, we need @@ -74,6 +78,7 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx prevDir = baseDir } else { prevDir = t.c.sfs.MakePathRelative(filepath.Dir(prev)) + if prevDir == "" { // Not a member of this filesystem. Let LibSASS handle it. return "", "", false @@ -100,8 +105,8 @@ func (t *toCSSTransformation) Transform(ctx *resources.ResourceTransformationCtx filenameToCheck := filepath.Join(basePath, fmt.Sprintf(namePattern, name)) fi, err := t.c.sfs.Fs.Stat(filenameToCheck) if err == nil { - if fir, ok := fi.(hugofs.RealFilenameInfo); ok { - return fir.RealFilename(), "", true + if fim, ok := fi.(hugofs.FileMetaInfo); ok { + return fim.Meta().Filename(), "", true } } } |