a cleaned public folder?

841 views
Skip to first unread message

David Kebler

unread,
Jul 23, 2014, 2:52:59 PM7/23/14
to hugo-d...@googlegroups.com
I've noticed as I move things around, change names and bring things in and out of the static folder that Hugo does not clear the public folder of this "old stuff".
I've resorted to deleting it on occasion just to "start anew".

Is there a config line to tell it to keep the directory clean?  If not can that be in a future version.  Not the end of the world here but I can imagine for folks I''d be setting Hugo up to use this would be confusing or at least irritating to them.   Sorry if I was a go coder I'd just make a pull request....maybe I will become one if it turns out I can't live without Hugo :-).

Leon Paternoster

unread,
Jul 24, 2014, 2:52:47 AM7/24/14
to hugo-d...@googlegroups.com
+1 this. Causes some head scratching during the first few builds.

Steve Francia

unread,
Jul 24, 2014, 6:21:08 PM7/24/14
to Leon Paternoster, hugo-d...@googlegroups.com
It would be easy to write, but not sure it's the "correct" answer... For people with large sets of static, I would rather make the default a more intelligent sync than we have now. We could offer a "clean" option in addition to this, but I don't think it should be the default. Please file an issue on github and we'll get to it at some point. 

--
Hugo

A Fast and Flexible Static Site Generator built with love by spf13 and friends in Go

Download the latest at https://github.com/spf13/hugo/releases
---
You received this message because you are subscribed to the Google Groups "Hugo Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hugo-discuss...@googlegroups.com.
To post to this group, send email to hugo-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/hugo-discuss.
For more options, visit https://groups.google.com/d/optout.

David Kebler

unread,
Jul 24, 2014, 7:39:14 PM7/24/14
to hugo-d...@googlegroups.com
Ok, will do.   By clean I mean clean out "old" files/directories no longer part of the build. 
  
BTW I had to scrub the whole public directory to get hugo to overwritie everything after a baseURL change and sometimes when I do this hugo doesn't rewrite the static stuff.  Might be more about being on "watch". I have taken to just doing a manual run in this case rather than depending on the watch.

While I am on this related topic (changing baseurl)  if the hugo command line could specify the config file then together with the -d swtich I could write batch commands one for development and one for production.    Or maybe there is a more elegant solution for the development/production issue.

Nate Finch

unread,
Aug 1, 2014, 3:50:16 PM8/1/14
to hugo-d...@googlegroups.com
I agree that hugo needs to clean up after itself.  

Weston McNamee

unread,
Jul 15, 2015, 6:20:08 PM7/15/15
to hugo-d...@googlegroups.com
I wrote this powershell function, which would need to be customized to exclude other files that hugo would not generate:

function hugo-clean-rebuild {
    if(-not (test-path 'config.yaml')) {
        write-warning "current directory does not appear to be a hugo site directory."
        return
    }
    gci -path .\public -exclude ".git", "readme.md" | %{ rm $_ -recurse }
    hugo
}

maybe that will help you (if on windows)
Reply all
Reply to author
Forward
0 new messages