mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Removing check for directory: static, layouts
Removed these checks so a single file in content can generate a site. For example, given a site with a content directory and an index.html, running hugo -s dir will generate a project without any more input.
This commit is contained in:
parent
861472bea5
commit
789aa6ad76
2 changed files with 16 additions and 7 deletions
|
@ -100,6 +100,11 @@ func build(watches ...bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyStatic() error {
|
func copyStatic() error {
|
||||||
|
staticDir := Config.GetAbsPath(Config.StaticDir + "/")
|
||||||
|
if _, err := os.Stat(staticDir); os.IsNotExist(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Copy Static to Destination
|
// Copy Static to Destination
|
||||||
return fsync.Sync(Config.GetAbsPath(Config.PublishDir+"/"), Config.GetAbsPath(Config.StaticDir+"/"))
|
return fsync.Sync(Config.GetAbsPath(Config.PublishDir+"/"), Config.GetAbsPath(Config.StaticDir+"/"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,11 +132,13 @@ func (s *Site) addTemplate(name, data string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) Process() (err error) {
|
func (s *Site) Process() (err error) {
|
||||||
s.initialize()
|
if err = s.initialize(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
s.prepTemplates()
|
s.prepTemplates()
|
||||||
s.timerStep("initialize & template prep")
|
s.timerStep("initialize & template prep")
|
||||||
if err = s.CreatePages(); err != nil {
|
if err = s.CreatePages(); err != nil {
|
||||||
return err
|
return
|
||||||
}
|
}
|
||||||
s.setupPrevNext()
|
s.setupPrevNext()
|
||||||
s.timerStep("import pages")
|
s.timerStep("import pages")
|
||||||
|
@ -248,9 +250,11 @@ func (s *Site) absPublishDir() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) checkDirectories() (err error) {
|
func (s *Site) checkDirectories() (err error) {
|
||||||
if b, _ := dirExists(s.absLayoutDir()); !b {
|
/*
|
||||||
return fmt.Errorf("No layout directory found, expecting to find it at " + s.absLayoutDir())
|
if b, _ := dirExists(s.absLayoutDir()); !b {
|
||||||
}
|
return fmt.Errorf("No layout directory found, expecting to find it at " + s.absLayoutDir())
|
||||||
|
}
|
||||||
|
*/
|
||||||
if b, _ := dirExists(s.absContentDir()); !b {
|
if b, _ := dirExists(s.absContentDir()); !b {
|
||||||
return fmt.Errorf("No source directory found, expecting to find it at " + s.absContentDir())
|
return fmt.Errorf("No source directory found, expecting to find it at " + s.absContentDir())
|
||||||
}
|
}
|
||||||
|
@ -266,10 +270,10 @@ func (s *Site) ProcessShortcodes() {
|
||||||
|
|
||||||
func (s *Site) CreatePages() (err error) {
|
func (s *Site) CreatePages() (err error) {
|
||||||
if s.Source == nil {
|
if s.Source == nil {
|
||||||
return fmt.Errorf("No source files found in", s.absContentDir())
|
panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
|
||||||
}
|
}
|
||||||
if len(s.Source.Files()) < 1 {
|
if len(s.Source.Files()) < 1 {
|
||||||
return fmt.Errorf("No source files found in", s.absContentDir())
|
return fmt.Errorf("No source files found in %s", s.absContentDir())
|
||||||
}
|
}
|
||||||
for _, file := range s.Source.Files() {
|
for _, file := range s.Source.Files() {
|
||||||
page, err := ReadFrom(file.Contents, file.LogicalName)
|
page, err := ReadFrom(file.Contents, file.LogicalName)
|
||||||
|
|
Loading…
Reference in a new issue