點燈坊

失くすものさえない今が強くなるチャンスよ

Cleaning Up the public Folder

Sam Xiao's Avatar 2022-03-02

Hugo doesn’t clean up the public folder. If you were to remove some pages or rename them, you would need to delete the generated versions from the public folder as well.

Version

Hugo 0.92

Delete public Folder Manually

$ rm -r public && hugo

Since hugo doesn’t clean up the public folder. We can use rm -r public manually with pm-run-all package.

cleanDestinationDir Argument

$ hugo --cleanDestinationDir

Alternatively, use Hugo’s --cleanDestinationDir argument.

Hugo for Production

$ hugo --cleanDestinationDir --minify

We can tell Hugo to minify the files it generates. This process removes whitespace characters, resulting in smaller file sizes that will make the site download faster for your visitors. To do this, use the --minify option.

Conclusion

  • We often use --cleanDestinationDir and --minify argument together with hugo for production