-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-remark-copy-linked-files): add support for video elements with src
attribute
#10395
feat(gatsby-remark-copy-linked-files): add support for video elements with src
attribute
#10395
Conversation
@@ -234,7 +234,7 @@ module.exports = ( | |||
|
|||
// Handle video tags. | |||
const videoRefs = [] | |||
$(`video source`).each(function() { | |||
$(`video source, video`).each(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
$(`video source, video`).each(function() { | |
$(`video source[src], video[src]`).each(function() { |
to target elements that actually have src
attribute?
With video source, video
selector we would push a lot of undefined
to videoRefs
array:
<video>
<source type="video/mp4" src="video.mp4"></source>
</video>
outer <video>
would be targeted by selector, but it doesn't have src so it doesn't make sense to push it to array, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, that's a great idea. I looked at the code again and saw that there is quite some duplication in that file. Would you be open if I refactor that file a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely open to that! After you mentioned it I just did quick browse of entire file (instead of just zooming in on area your changes) and see that the handling of video, audio and anchor tags is essentially copy'n'pasted and could be DRYed a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src
attributesrc
attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for feature and refactor @janmonschke!
Holy buckets, @janmonschke — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
* master: (1037 commits) Update starters.yml (gatsbyjs#10505) chore(release): Publish fix(graphql-skip-limit): fix hasNextPage (gatsbyjs#10504) chore: use cjs instead of esm for consistency (gatsbyjs#10494) feat(gatsby-remark-copy-linked-files): add support for video elements with `src` attribute (gatsbyjs#10395) typofix (gatsbyjs#10488) Add kobit.in to showcase (gatsbyjs#10496) fix(docs): window.reload => window.location.reload (gatsbyjs#10459) feat(www): add unbird feedback component to starter lib (gatsbyjs#10450) fix(blog): youfit case study typofix Doc improvements to Visual testing with Storybook guide (gatsbyjs#10436) fix(gatsby-plugin-offline): prevent incorrect revisioning of static file by workbox (gatsbyjs#10416) fix(starters): ttag repo link fix typo in pull request template (gatsbyjs#10454) fix(www) Fix query for plugin links always ?=undefined (gatsbyjs#10453) chore(release): Publish fix(gatsby): fix extracting StaticQuery nested in shorthand fragment (gatsbyjs#10443) fix(www): avoid querying for no-cache=1 (gatsbyjs#10389) fix(gatsby-image): update typescript definitions - properly mark fields as optional (gatsbyjs#10419) refactor(gatsby): improve EnsureResources (gatsbyjs#10224) ...
* master: docs: add ibm case study blog post (gatsbyjs#10474) Update sites.yml (gatsbyjs#10512) Update starters.yml (gatsbyjs#10505) chore(release): Publish fix(graphql-skip-limit): fix hasNextPage (gatsbyjs#10504) chore: use cjs instead of esm for consistency (gatsbyjs#10494) feat(gatsby-remark-copy-linked-files): add support for video elements with `src` attribute (gatsbyjs#10395) typofix (gatsbyjs#10488) Add kobit.in to showcase (gatsbyjs#10496) fix(docs): window.reload => window.location.reload (gatsbyjs#10459) # Conflicts: # packages/gatsby/CHANGELOG.md # packages/gatsby/package.json
… with `src` attribute (gatsbyjs#10395) This adds support for video elements that only have a `src` attribute. ```html <video src="myvideo.mp4"></video> ```
This adds support for video elements that only have a
src
attribute.