29 lines
698 B
Go
29 lines
698 B
Go
package helper
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"gitbase.de/apairon/mark2web/config"
|
|
cpy "github.com/otiai10/copy"
|
|
)
|
|
|
|
// ProcessAssets copies the assets from input to output dir
|
|
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)
|
|
}
|
|
}
|
|
}
|