Are "assets" and "static" folders interchangeable?

I have both defined as static directories. CSS and JS are in the assets folder (no SASS or SCSS) and everything else (images, _headers file, etc) are in the static folder. Can I use either to house static files or is it better to keep them separate?

Project organization is up to you. If you have mounted both assets and static as the staticDir then you can use them both ways.

I read in the Hugo Documentation that assets is for Hugo Pipes and thus split both directories.

I just noticed putting any other thing other than CSS and JS in the assets folder is not copied over to the public folder.

In my rough understanding, files in static are always pulled on a build, where assets only when needed/requested by the code/function/module/shortcode etc.

You may have 10 versions of a file in assets and call for 1 only in code, then folder on the build website will serve only 1 file (links to 9 others will results in file not found)

When you got 10 versions of a file in static on the build you will have all 10 files served (accessible).

1 Like

@idarek interesting. I see the others are being put in the public folder locally while inside the assets folder. Perhaps that is a recent Hugo thing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.