示例#1
0
文件: storage.go 项目: hblend/hblend
func (s *Storage) Path(l *location.Location) string {
	path := ""
	if l.IsRemote() {
		u, _ := url.Parse(l.Dir)
		path = filepath.Join(s.Config.BaseDir, s.Config.RemoteDir, u.Host, u.Path, l.Filename)
		download(l.Dir+l.Filename, path)
	} else {
		path = filepath.Join(s.Config.BaseDir, l.Dir, l.Filename)
	}

	return path
}
示例#2
0
func New(l *location.Location) *Component {

	if "" == l.Filename {
		l.Filename = "index"
	}

	html := ""
	css := ""
	js := ""

	return &Component{
		Location: l,
		Html:     &html,
		Css:      &css,
		Js:       &js,
		included: map[string]*Component{},
		Linked:   map[string]bool{},
		Files:    map[string]string{},
		TagsJs:   []string{},
		TagsCss:  []string{},
	}
}