hugo-lambda icon indicating copy to clipboard operation
hugo-lambda copied to clipboard

Doesn't copy static files to output bucket

Open timothyf opened this issue 8 years ago • 4 comments

The static files located in the root of the project under the "static" directory, as well as the static directory that is part of a theme are not being copied to the output directory when the hugo lambda function runs. Looking at the Lambda logs, I see the following error:

2016-04-27T18:58:55.338Z 0c4571b6-0caa-11e6-8377-fdd7b0081caf hugo-stdout: ERROR: 2016/04/27 Unable to find static directory for theme hugo-future-imperfect in /tmp/sources/themes/hugo-future-imperfect/static

However, I verified that "/themes/hugo-future-imperfect/static" does indeed exist in my input S3 bucket.

timothyf avatar Apr 27 '16 19:04 timothyf

Hello Ryan!

I'm getting the same issue as well even though the static directory exists.

2016-08-18T03:22:33.688Z  done downloading
2016-08-18T03:22:33.870Z  made static dir: 0
2016-08-18T03:22:33.870Z  Running hugo
2016-08-18T03:22:34.009Z  hugo-stdout: INFO: 2016/08/18 03:22:34 hugo.go:463: Using config file: /tmp/sources/config.toml
2016-08-18T03:22:34.009Z  hugo-stdout: WARN: 2016/08/18 03:22:34 hugo.go:547: Unable to find static directory for theme hugo-redlounge in /tmp/sources/themes/hugo-redlounge/static
themes
└── hugo-redlounge
    ├── LICENSE.md
    ├── README.md
    ├── archetypes
    │   └── default.md
    ├── images
    │   ├── screenshot.png
    │   └── tn.png
    ├── layouts
    │   ├── _default
    │   │   ├── list.html
    │   │   └── single.html
    │   ├── index.html
    │   └── partials
    │       ├── authorsocial.html
    │       ├── bodyend.html
    │       ├── doctype.html
    │       ├── footer.html
    │       ├── headend.html
    │       ├── header.html
    │       ├── listtop.html
    │       ├── meta.html
    │       ├── og.html
    │       ├── sidebar.html
    │       ├── sidebarheader.html
    │       ├── singletop.html
    │       ├── socialsharing.html
    │       └── syntaxhighlight.html
    ├── static
    │   ├── css
    │   │   ├── lightbox.css
    │   │   ├── redlounge.css
    │   │   ├── rrssb.css
    │   │   └── screen.css
    │   ├── favicon.png
    │   ├── img
    │   │   ├── close.png
    │   │   ├── loading.gif
    │   │   ├── next.png
    │   │   └── prev.png
    │   ├── js
    │   │   ├── lightbox.min.js
    │   │   └── rrssb.min.js
    │   └── touch-icon-144-precomposed.png
    └── theme.toml

10 directories, 35 files

ju4npabl0 avatar Aug 18 '16 05:08 ju4npabl0

@timothyf @ju4npabl0 Either of you ever figure this out?

bocan avatar Feb 15 '17 01:02 bocan

That's strange - thanks for the directory tree. I'll try to reproduce this.

ryansb avatar Jun 23 '17 14:06 ryansb

Oh, I see the issue. So on generation, hugo-lambda doesn't download the static directories to save execution time https://github.com/ryansb/hugo-lambda/blob/master/functions/generate/run_hugo.py#L45

Then in the part of the code that handles static files, it should be grabbing the contents of that directory (e.g. themes/hugo-redlounge/static/css/lightbox.css) and copying it to the destination bucket as css/lightbox.css. Can you provide an S3 ls of the production bucket?

ryansb avatar Jun 23 '17 14:06 ryansb