setupin
English | 简体中文
😏 What is a setupin?
setupin allows you to use Vue SFC syntax in HTML.
Using the sfc2esm, which compiled at runtime for esm vue code format, and dynamic execution.
🤯 Code comparison
esm.html
vue esm is complicated to write
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>esm</title>
<style>
button {
font-size: larger;
}
</style>
</head>
<body>
<div id="app">
<button @click="count++">{{ count }}</button>
</div>
<script type="module">
import { createApp, defineComponent, ref } from 'https://unpkg.com/vue/dist/vue.esm-browser.js';
const App = defineComponent(() => {
const count = ref(0);
return {
count
};
});
createApp(App).mount('#app')
</script>
</body>
</html>
setup.vue
vue sfc needs to be compiled
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<button @click="count++">{{ count }}</button>
</template>
<style>
button {
font-size: larger;
}
</style>
setupin.html
setupin brings it all together
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>setupin</title>
<script src="https://unpkg.com/setupin"></script>
</head>
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<button @click="count++">{{ count }}</button>
</template>
<style>
button {
font-size: larger;
}
</style>
It's exactly the same as Vue SFC except for the <head>
🤓 Characteristics
🤔 Why setupin
- Easy to learn Offer a friendly environment for beginners to easily grasp the core usage of Vue.
- Simple development Provide a convenient way to rapidly develop small webpage without complex configurations.
- Quick experience Allow users to quickly experiment with Vue's new features in HTML and feel its charm.
😝 Playground
try it on stackblitz !
🥰 Usage
<!-- The default is the dev version -->
<script src="https://unpkg.com/setupin"></script>
<!-- dev -->
<script src="https://unpkg.com/setupin/dist/main.js"></script>
<!-- prod -->
<script src="https://unpkg.com/setupin/dist/main.prod.js"></script>
Related Packages
@vuedx/compiler-sfc
This package extracts `parse()` function [@vue/compiler-sfc] as ES module.
250,768
1,251
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 3.3.1 | MIT | ||
| 3.3.0 | MIT | ||
| 3.2.0 | MIT | ||
| 3.1.2 | MIT | ||
| 3.1.1 | MIT | ||
| 3.1.0 | ^3.5.12 | MIT | |
| 3.0.0 | ^3.5.12 | MIT | |
| 2.6.1 | ^3.5.12 | MIT | |
| 2.6.0 | ^3.5.12 | MIT | |
| 2.5.1 | ^3.5.12 | MIT | |
| 2.4.3 | ^3.5.12 | MIT | |
| 2.4.2 | ^3.5.12 | MIT | |
| 2.4.1 | ^3.5.12 | MIT | |
| 2.4.0 | ^3.5.12 | MIT | |
| 2.3.1 | ^3.5.12 | MIT | |
| 2.3.0 | ^3.5.12 | MIT | |
| 2.2.3 | ^3.5.12 | MIT | |
| 2.2.2 | MIT | ||
| 2.2.1 | MIT | ||
| 2.2.0 | MIT | ||
| 2.1.10 | MIT | ||
| 2.1.9 | MIT | ||
| 2.1.8 | MIT | ||
| 2.1.7 | MIT | ||
| 2.1.6 | MIT | ||
| 2.1.5 | MIT | ||
| 2.1.4 | MIT | ||
| 2.1.3 | MIT | ||
| 2.1.2 | MIT | ||
| 2.1.1 | MIT |
Showing the latest 30 of 43. See every release on npm
Pre-releases (5)
| Version | Released | Vue | License |
|---|---|---|---|
| 3.3.0-beta.1 | MIT | ||
| 3.0.0-beta.2 | ^3.5.12 | MIT | |
| 2.6.2-beta.1 | ^3.5.12 | MIT | |
| 2.5.0-beta.2 | ^3.5.12 | MIT | |
| 2.5.0-beta.1 | ^3.5.12 | MIT |