daKmoR / rocket

Move to https://github.com/modernweb-dev/rocket/
MIT License
13 stars 5 forks source link

Support .jpeg assets #138

Closed gdbaldw closed 3 years ago

gdbaldw commented 3 years ago

Build fails to copy .jpeg assets.

To recreate failure, rename a .jpg asset to .jpeg, then build.

daKmoR commented 3 years ago

where is the image located? and which code usees it how?

gdbaldw commented 3 years ago

Where? In a sub-sub-folder under /docs

/docs/A/B/images/C.jpg copies into _site_dev/A/B/images/C.jpg

But, /docs/A/B/images/C.jpeg does not copy.

Which code? $ yarn start Copy occurs for jpg, does not for jpeg

$ yarn build Fails with Error when rollup cannot find the .jpeg file in _site_dev

daKmoR commented 3 years ago

I meant more like how is it used in the html 😅

in most cases, Rocket does not need any copying of images/assets as it auto-detects assets within html and js.

e.g.

<img src="../foo.jpeg" alt="foo" />

or

const imgUrl = new URL('../bar.jpeg', import.meta.url).href;

const img = document.createElement('img');
img.src = imgUrl;

will not require any copying 💪

Therefore I'm wondering how you use it which would require copying 🤔

gdbaldw commented 3 years ago

Oh! My two test cases are front matter in YAML format, and as a Markdown link:

  1. In front matter (e.g. the rocket "blog" theme)

'---' cover_image: /A/B/images/C.jpg '---'

  1. As a markdown link [image](/A/B/images/C.jpg)
daKmoR commented 3 years ago

I thought about this the wrong way... I thought the problem was with rollup but it's probably with 11ty...

can you try adding .jpeg to this copy command https://github.com/daKmoR/rocket/blob/master/packages/cli/src/shared/.eleventy.cjs#L48

gdbaldw commented 3 years ago

Yes, that's it!

can you try adding .jpeg to this copy command https://github.com/daKmoR/rocket/blob/master/packages/cli/src/shared/.eleventy.cjs#L48