Skip to content

Commit

Permalink
fixed bug where included files in embedded directories from templates…
Browse files Browse the repository at this point in the history
… would not copy
  • Loading branch information
Rob Saunders committed Jul 26, 2017
1 parent 35c3c13 commit fb90852
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/cmd/gen/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ func helperCopyFile(rel string, sitename string) string {
src := findFile(rel, sitename)
dest := filepath.Clean(filepath.Join("public", sitename, rel))

println("copying", src, dest)

dir, _ := filepath.Split(dest)
makeDirIfMissing(dir)

if err := cp(src, dest); err != nil {
createError(src, err)
} else {
Expand Down
24 changes: 22 additions & 2 deletions src/cmd/gen/sass.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"bytes"
"path/filepath"
"strings"

"github.com/wellington/go-libsass"
Expand All @@ -10,8 +12,26 @@ import (
type SassProcessor struct{}

func (p SassProcessor) compile(tpl *TemplateWriter) error {
_, err := libsass.New(tpl.writer, tpl.buffer)
return err
buffer := new(bytes.Buffer)
err := libsass.ToScss(tpl.buffer, buffer)
if err != nil {
return err
}

compiler, err := libsass.New(tpl.writer, buffer)
if err != nil {
return err
}

// configure @import paths
srcDir, _ := filepath.Split(tpl.src)
includePaths := []string{"sites/_shared/styles", srcDir}
compiler.Option(libsass.IncludePaths(includePaths))
if err != nil {
return err
}

return compiler.Run()
}

func (p SassProcessor) dstfile(filename string) string {
Expand Down

0 comments on commit fb90852

Please sign in to comment.