Why does hugo create the resources directory?

Hi Hugo Community,

Very excited about this project; first time poster, looking to learn more!

During the following hello world example, hugo creates the resources directory. I’m not sure why.

Example

rm -rf *
tree
.

0 directories, 0 files
mkdir content layouts
touch config.yml
echo hello world > layouts/index.html
tree
.
├── config.yml
├── content
└── layouts
    └── index.html

2 directories, 2 files
hugo server &
tree
.
├── config.yml
├── content
├── layouts
│   └── index.html
└── resources

3 directories, 2 files
curl localhost:1313/
hello world
hugo --help | grep resources
man hugo | grep resources

Questions

  • See how before I run hugo server there is no resources directory; however, afterwards there is?
  • What’s the point of this empty directory? I searched the man page and the help but there is no mention of anything related to resources
  • Does it have anything to do with Page Resources?
  • What’s the absolute minimum that I need to put in that directory for something related to that directory to print to the screen?
1 Like

You don’t put anything there yourself, it’s where Hugo puts generated resources. For example, if you use image processing that’s where the processed images go. Also, playing with the awesome Hugo Pipes puts a few more files in there. :slight_smile:

(This is my understanding as a user myself, can’t really help if you need more technical explanation.)

Happy Hugo-ing!

It is, in short, a resource cache. I put it in the project (by default, there is a setting) to make it visible – you can commit parts or the whole directory to Git, if that fits your style.

  • If you are theme author, you will most likely want to put the generated/fingerprinted resources as part of the theme distribution, so the users does not need to have PostCSS etc. installed to run your theme.
  • If you use lots of thumbnails, you may consider comitting this to GitHub to avoid having to create thumbnails on every CI build etc.
5 Likes

See answer above for rationale.

In many cases you will not need to keep generated files. If you’re using git you can prevent the generated files from accidental checkin by adding resources on its own line in your .gitignore file. If you use Atom the addition will also prevent generated files from becoming searchable within the editor.

1 Like

A post was split to a new topic: Change location of resources directory