Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor issue? A little confused. #4

Open
whitedann opened this issue Apr 24, 2019 · 2 comments
Open

Minor issue? A little confused. #4

whitedann opened this issue Apr 24, 2019 · 2 comments

Comments

@whitedann
Copy link

First of all thank you for writing this plugin. I have gotten it to work and it is very useful. But I encountered an issue with it and being relatively new, I'm not sure if there's something simple involving the way Gatsby handles its file system...

  • I have my locally stored .mp4 video in the same folder as my markdown file. I reference it in the markdown file as instructed: ! [ ] (filename.mp4).
  • When I compile the project, Gatsby finds the file and saves it to public/static as "filename-long-hash.mp4".
  • gatsby-remark-videos goes to look for a file in public/static called "filename.mp4", but can't find it because it's been changed to "filename-long-hash.mp4", and so the files aren't transcoded.

My work around to this was to look for the name of the file in videoPath, i.e. I replaced:

return file.absolutePath === videoPath;

with

return videoPath.includes(file.absolutePath.slice(0,-4));

on line 72 of index.js.

But I'm guessing this is not really needed. Where should I be putting my .mp4s so that they don't get renamed like this?

Also I don't know if this is a big deal but the plugin will not work when installed into node-modules, because I believe Gatsby plugins require an index.js file in the plugin root. But if you have the plugin in the optional "plugins" directory in the project root, it seems to work fine. This was a problem for me because "npm install " installs into node_modules by default. I guess you could make a no-op index.js file to get around this. I've noticed many other plugins do this.

Sorry if this is a silly issue. Thanks for all your hard work!

@jhodges10
Copy link

@Mike-Dax any response for this?

@Mike-Dax
Copy link
Owner

Sorry @whitedann the notification for this got lost on its way to me.

I can't replicate your issue - can you have a try with the latest version?

I'm literally putting the files in the same directory as the markdown.

image

Video test

![](videotest.mp4)

Do you have a plugin to copy the referenced files

...
{
  resolve: `gatsby-remark-copy-linked-files`,
  options: {},
},
...

Regarding the index.js file - my understanding is gatsby respects the main convention in the package.json.

Regardless - can you have a go with the latest version? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants