Mike-Dax / gatsby-remark-videos

Embed html5 style looping videos in your Gatsby site direct from your markdown. Used on https://electricui.com
MIT License
13 stars 13 forks source link

Minor issue? A little confused. #4

Open whitedann opened 5 years ago

whitedann commented 5 years ago

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...

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 commented 5 years ago

@Mike-Dax any response for this?

Mike-Dax commented 5 years ago

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.