mark2web/helper/assets.go
Sebastian Frank d78ecf4682
All checks were successful
continuous-integration/drone/push Build is passing
reorganizes processing code
2019-02-28 12:13:28 +01:00

28 lines
638 B
Go

package helper
import (
"strings"
"gitbase.de/apairon/mark2web/config"
cpy "github.com/otiai10/copy"
)
func ProcessAssets() {
switch config.Config.Assets.Action {
case "copy":
from := config.Config.Assets.FromPath
to := config.Config.Assets.ToPath
if !strings.HasPrefix(from, "/") {
from = config.Config.Directories.Input + "/" + from
}
if !strings.HasPrefix(to, "/") {
to = config.Config.Directories.Output + "/" + to
}
Log.Noticef("copying assets from '%s' to '%s'", from, to)
err := cpy.Copy(from, to)
if err != nil {
Log.Panicf("could not copy assets from '%s' to '%s': %s", from, to, err)
}
}
}