egoist / vmark

Convert markdown to Vue component.
MIT License
162 stars 11 forks source link

Emit single-file component #2

Open egoist opened 6 years ago

egoist commented 6 years ago

So that we don't need to compile template to render function

miljan-aleksic commented 6 years ago

Probably that would solve the issue I am having with ES6 modules forced strict mode and the use of with by render functions.

screen shot 2018-02-22 at 14 37 55

miljan-aleksic commented 6 years ago

But take in consideration that if in some future vmark adds support for subcomponents the SFC would not fit. Eg:

---
data
---
The main component

\```code:custom
---
data
---
a subcomponent with it own scope
\```
egoist commented 6 years ago

@miljan-aleksic should be fixed in vmark@0.1.2 😄

egoist commented 6 years ago

The main advantage of emitting SFC is out-of-box HMR support with vue-loader 😄

miljan-aleksic commented 6 years ago

One of the reasons I dropped the idea of emitting SFC is this one.

In my implementation running the code several times per file was an issue beyond performance. A cache would solve it, but when doing so many workarounds is probably better to find another way.

It is so complex to add an own HMR support? I need yet to check.

egoist commented 6 years ago

should not be hard with https://github.com/vuejs/vue-hot-reload-api but I haven't tried this yet

miljan-aleksic commented 6 years ago

Thanks, @egoist, I wasn't aware of the HotReload API and integrating it was not difficult. Now I can speed up my dev!