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: Using Babel for Vue components inside md files (#318) #336

Merged
merged 1 commit into from
May 10, 2018

Conversation

HandOfGod94
Copy link
Contributor

Vue components now created with jsx is rendering inside .md files.
I have removed buble-loader as it will be redundant to use both.
Let me know if we need to check any specific things.

@yyx990803
Copy link
Member

Can you confirm async/await works with the setup?

@HandOfGod94
Copy link
Contributor Author

HandOfGod94 commented May 3, 2018

Hi @yyx990803,
Yes, Its working as expected.
I tried with following component.

export default {
  name: 'my-component',
  mounted () {
    this.getMsg()
  },
  data () {
    return {
      msg: 'Initial Content'
    }
  },
  methods: {
    getMsg: async function () {
      let promise = new Promise((resolve, reject) => {
        setTimeout(() => resolve("Hello World from async"), 5000)
      })
      let result = await promise;
      this.msg = result
    }
  },
  render (h) {
    return (
      <div>{this.msg}</div>
    )
  }
}

And then used it inside .md file for demo as

<my-component />

@HandOfGod94 HandOfGod94 changed the title feat: Using Babel for Vue components insde md files (#318) feat: Using Babel for Vue components inside md files (#318) May 3, 2018
Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

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

LGTM, Can you also give a table that contains the sizes comparison before and after this setup. thanks!

@HandOfGod94
Copy link
Contributor Author

Size Comparison

Application Before After
VuePress Docs(Build) 1.14MB 1.17MB
CustomApp Docs(Build) 146KB 168KB
CustomApp with JSX Docs(Build) failed 168KB

@ulivz
Copy link
Member

ulivz commented May 5, 2018

@HandOfGod94 Thanks for the great work.

@ulivz ulivz merged commit 82cd8bd into vuejs:master May 10, 2018
This was referenced May 10, 2018
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

Successfully merging this pull request may close these issues.

None yet

3 participants