thuliteio / create-thulite

Official CLI for scaffolding a new Thulite project
Other
0 stars 1 forks source link

Add static dir to module mounts #8

Closed mdehollander closed 1 year ago

mdehollander commented 1 year ago

Description

Files stored in the static dir are not included in the hugo build. For example the favicons are not found.

Steps to reproduce

Run the create hyas project and see if the favicon are found in the logs.

Expected result

The files in the static dir should be added to the public directory

Actual result

The static files are not included

mdehollander commented 1 year ago

Add the static dir to the module.toml makes that the content of the static folder is included in the build.

[[mounts]]
  source = "static"
  target = "static"
h-enk commented 1 year ago

Thanks, I see what you mean. I'll have to take a closer look at it. Not quite sure what my rationale was.

For now, I think we should have a default (on gethyas or @hyas/core level) and an override possibility (on @hyas/seo level and/or on theme level: @hyas/themes-starter-bootstrap and @hyas/themes-doks).

Get back to you!

h-enk commented 1 year ago

Can't reproduce (anymore), but will check again when updating this repo.

h-enk commented 1 year ago

Tested with the new create-hyas (v1.0.3): bootstrap-starter-rec, replaced favicons, no module mount for static, seems to be working/looks OK to me:

Snag_9da53d

salim-b commented 1 year ago

Files in static/ work for me, too (with latest create-hyas). Thus I think this can be closed.

h-enk commented 1 year ago

Will close this issue for now then. Mattias, feel free to reopen if you think that's needed.

salim-b commented 1 year ago

From relevant doc:

When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.

Since none of Doks current mounts target static, we don't need to explicitly add

[[mounts]]
  source = "static"
  target = "static"

Hugo already adds that implicitly.

But I guess it wouldn't hurt to explicitly add the remaining default mounts to our config, it would probably be clearer for people unfamiliar with Hugo mounts.

Currently absent default mounts include:

[[module.mounts]]
  source = 'i18n'
  target = 'i18n'
[[module.mounts]]
  source = 'static'
  target = 'static'

@h-enk What do you think?

h-enk commented 1 year ago

But I guess it wouldn't hurt to explicitly add the remaining default mounts to our config, it would probably be clearer for people unfamiliar with Hugo mounts.

I certainly agree /let's do that.

salim-b commented 1 year ago

But I guess it wouldn't hurt to explicitly add the remaining default mounts to our config, it would probably be clearer for people unfamiliar with Hugo mounts.

I certainly agree /let's do that.

here u go: https://github.com/gethyas/create-hyas/pull/12

h-enk commented 1 year ago

Merged: https://github.com/gethyas/create-hyas/pull/12