# jsv-compiler

> use vue3 template in .js

Latest version **0.0.2** (published 2020-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsv-compiler
pnpm add jsv-compiler
yarn add jsv-compiler
bun add jsv-compiler
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-09-27 |
| First published | 2020-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 1 |
| Unpacked size | 6 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | 瑞龚 |
| Maintainers | ruige24601 |
| Keywords | vue, jsv, js |

## Links

- npm: https://www.npmjs.com/package/jsv-compiler
- Repository: https://github.com/ruige24601/jsv-compiler
- Homepage: https://github.com/ruige24601/jsv-compiler#readme
- Issues: https://github.com/ruige24601/jsv-compiler/issues
- npm.io page: https://npm.io/package/jsv-compiler

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.6.12

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.2 (latest) — 2020-09-27
- 0.0.1 — 2020-09-27

## README

在 *.js* 文件中使用 vue3 模板语法

# 使用
### 1. 创建vue3项目
```
create-vite-app <your projectname>
```
### 2. 安装依赖包
```
npm i -D jsv-compiler
```
### 3. 配置插件
文件: *vite.config.js*
```js
import {jsvPlugin} from 'jsv-compiler'

export default {
  configureServer: [jsvPlugin]
}
```
### 4. 使用示例
```js
import { reactive } from "vue";

export default {
	name: "App",
	setup() {
		let state = reactive({ 
			title: 'jsv-compiler',
			count: 0 
		});

		function handleClick() {
			state.count++;
		}

		let Title = `<template><h1>hello {{state.title}}</h1></template>`
		
		return (`
			<template>
				<Title />
				<div>{{ state.count }}</div>
				<button v-on:Click="handleClick">点击加1</button>
			</template>
			`)
	},
};
```
### 5. 语法高亮
在vscode中下载插件: jsv

---
_Source: https://npm.io/package/jsv-compiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
