vue-deno-compiler icon indicating copy to clipboard operation
vue-deno-compiler copied to clipboard

Add examples for API and high-level workflow

Open MichaelCurrin opened this issue 4 years ago • 3 comments
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

MichaelCurrin avatar Feb 11 '21 08:02 MichaelCurrin

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)
``` 

MichaelCurrin avatar Feb 11 '21 08:02 MichaelCurrin

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.

MichaelCurrin avatar Feb 11 '21 08:02 MichaelCurrin

Oh I see in the content in README.md was lifted as is from https://www.npmjs.com/package/@vue/compiler-sfc

MichaelCurrin avatar Feb 11 '21 20:02 MichaelCurrin