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

[Feat]: For Vue docs, use a more common SFC format #701

Merged
merged 1 commit into from
Jan 25, 2024
Merged

[Feat]: For Vue docs, use a more common SFC format #701

merged 1 commit into from
Jan 25, 2024

Conversation

mujahidfa
Copy link
Contributor

@mujahidfa mujahidfa commented Jan 17, 2024

Feature description

To use a format for Vue Single File Components (SFCs) that is more succint and commonly used by the Vue community.

As per what is shown in the Introduction page of the Vue docs:

  1. <script setup> is more commonly used, and
  2. <script setup> -> <template> -> <style scoped> order is more common

Here's the current example found in the docs:

<template>
  <div class="embla" ref="emblaNode">
    <div class="embla__container">
      <div class="embla__slide">Slide 1</div>
      <div class="embla__slide">Slide 2</div>
      <div class="embla__slide">Slide 3</div>
    </div>
  </div>
</template>

<script>
  import emblaCarouselVue from 'embla-carousel-vue'

  export default {
    setup() {
      const [emblaNode] = emblaCarouselVue()
      return { emblaNode }
    }
  }
</script>

And here's the proposed change in format - less verbose, more commonly used:

<script setup>
import emblaCarouselVue from 'embla-carousel-vue'

const [emblaNode] = emblaCarouselVue()
</script>

<template>
  <div class="embla" ref="emblaNode">
    <div class="embla__container">
      <div class="embla__slide">Slide 1</div>
      <div class="embla__slide">Slide 2</div>
      <div class="embla__slide">Slide 3</div>
    </div>
  </div>
</template>

Copy link
Owner

@davidjerleke davidjerleke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mujahidfa,

Thanks a lot for your contribution, great initiative 👍. While at it, would you mind going through the code blocks in the API section and see if we can find more places where we could use the more succinct syntax? For example (.mdx files are located here):

Thanks a lot for your time!

Best,
David

@davidjerleke davidjerleke added documentation Improvements or additions to documentation vue Issue is related to Vue feature request New feature or request labels Jan 18, 2024
@mujahidfa
Copy link
Contributor Author

Hi @mujahidfa,

Thanks a lot for your contribution, great initiative 👍. While at it, would you mind going through the code blocks in the API section and see if we can find more places where we could use the more succinct syntax? For example (.mdx files are located here):

Thanks a lot for your time!

Best, David

Implemented in aea826e!

@davidjerleke
Copy link
Owner

@mujahidfa thanks for the additions 🙂!

Copy link
Owner

@davidjerleke davidjerleke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work ⭐️! I will merge this as soon as possible.

@davidjerleke davidjerleke changed the title Feat: For Vue docs, use a more common SFC format [Feat]: For Vue docs, use a more common SFC format Jan 22, 2024
Co-authored-by: David Jerleke <david.jerleke@gmail.com>
Co-authored-by: Mujahid Anuar <17759705+mujahidfa@users.noreply.github.com>
@davidjerleke
Copy link
Owner

Thanks @mujahidfa for this. Really nice improvement ⭐. I decided to scrap the vue prism language alias because it breaks syntax highlighting in the .mdx files which I think is pretty important. Other than that this is awesome.

Best,
David

@davidjerleke davidjerleke merged commit e7ad6db into davidjerleke:master Jan 25, 2024
@davidjerleke davidjerleke added the resolved This issue is resolved label Jan 25, 2024
@mujahidfa mujahidfa deleted the feature/#700 branch March 20, 2024 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature request New feature or request resolved This issue is resolved vue Issue is related to Vue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants