示例#1
0
func loadAsset(filename string) (asset themekit.Asset, err error) {
	root, err := os.Getwd()
	if err != nil {
		return
	}

	return themekit.LoadAsset(root, filename)
}
示例#2
0
func enqueueEvents(client themekit.ThemeClient, filenames []string, events chan themekit.AssetEvent) {
	root, _ := os.Getwd()
	if len(filenames) == 0 {
		go fullReplace(client.AssetListSync(), client.LocalAssets(root), events)
		return
	}
	go func() {
		for _, filename := range filenames {
			asset, err := themekit.LoadAsset(root, filename)
			if err == nil {
				events <- themekit.NewUploadEvent(asset)
			}
		}
		close(events)
	}()
}