vue-deno-compiler
vue-deno-compiler copied to clipboard
Add examples for API and high-level workflow
trafficstars
I found these as exported functions at the bottom of the very long 1MB compiler script.
compileScript,
compileStyle,
compileStyleAsync,
compileTemplate,
generateCodeFrame,
parse,
rewriteDefault,
It would be nice to list those all in the README.md
The current example as console.log(parse(....)); // component to parse. is too vague - how / what do I pass as component.
Example content.
## API
### parse
```typescript
import { parse } from "https://deno.land/x/vue_sfc_compiler/mod.ts";
const component = ... // Is this a Vue object, a dictionary, a loaded .vue file?
parse(component)
```
### compileScript
Used to compile a Vue script tag into a whatever...
Example:
```typescript
import { compileScript } from "https://deno.land/x/vue_sfc_compiler/mod.ts";
const x = '<script>console.log()</script>'
compileScript(x)
```
In the currently high-level workflow section of the README.md file, it would be also be useful to have examples for each with a code block of just a few lines.
Oh I see in the content in README.md was lifted as is from https://www.npmjs.com/package/@vue/compiler-sfc