28 lines
638 B
Go
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)
|
|
}
|
|
}
|
|
}
|