1657877456
In this video, let's take a look at all the major changes in Vite 3 and how one can start working on it right away!
In February last year, Evan You released Vite 2. Since then, its adoption has grown non-stop, reaching more than 1 million npm downloads per week. A sprawling ecosystem rapidly formed after the release. Vite is powering a renewed innovation race in Web frameworks. Nuxt 3 uses Vite by default. SvelteKit, Astro, Hydrogen, and SolidStart are all built with Vite. Laravel has now decided to use Vite by default. Vite Ruby shows how Vite can improve Rails DX. Vitest is making strides as a Vite-native alternative to Jest. Vite is behind Cypress and Playwright's new Component Testing features, Storybook has Vite as an official builder. And the list goes on. Maintainers from most of these projects got involved in improving the Vite core itself, working closely with the Vite team and other contributors.
Today, 16 months from the v2 launch we are happy to announce the release of Vite 3. We decided to release a new Vite major at least every year to align with Node.js's EOL, and take the opportunity to review Vite's API regularly with a short migration path for projects in the ecosystem.
Quick links:
If you are new to Vite, we recommend reading the Why Vite Guide. Then check out the Getting Started and Features guide to see what Vite provides out of the box. As usual, contributions are welcome at GitHub. More than 600 collaborators have helped improve Vite so far. Follow the updates on Twitter, or join discussions with other Vite users on our Discord chat server.
Go to vitejs.dev to enjoy the new v3 docs. Vite is now using the new VitePress default theme, with a stunning dark mode between other features.
Several projects in the ecosystem have already migrated to it (see Vitest, vite-plugin-pwa, and VitePress itself).
If you need to access the Vite 2 docs, they will remain online at v2.vitejs.dev. There is also a new main.vitejs.dev subdomain, where each commit to Vite’s main branch is auto deployed. This is useful when testing beta versions or contributing to the core’s development.
There is also now an official Spanish translation, that has been added to the previous Chinese and Japanese translations:
Read more: https://vitejs.dev
#javascript #vite #vitejs
1656752400
Vuelix is a Vue 3 + Vite starter template to scaffold new projects really fast and with a great developer experience.
Install Dependencies
npm install
Generate API client
npm run gen-api
NOTE: This command requires a java
jvm
to be installed, if you want to avoid asking all developers to install it check OpenAPI Client Generator for more info.
Start the development server
npm run dev
To build the app, run
npm run build
And to preview it, after building the app run
npm run serve
The version 3 of Vue with its powerful Composition API is available in this project.
The new <script setup>
SFCs syntax is also available and recommended.
Vite is the lightning Fast Next Generation Frontend Tooling that highly improves the development experience along with all the community-created plugins.
NOTE: The initial state of this project was generated using Vite oficial scaffolding:
npm init vite@latest
See:
TypeScript and SCSS languages are supported and strongly recommended.
See:
Routes for vue-router
will be auto-generated from Vue files in the src/pages
using the file structure.
See:
Vue components in the src/layouts
dir are used as layouts. By default, default.vue
will be used unless an alternative is specified in the route meta.
You can specify the layout in the page's SFCs like this:
<route lang="yaml">
meta:
layout: home
</route>
See:
@/
is aliased to the ./src/
folder.
For example, instead of having
import HelloWorld from '../../../components/HelloWorld.vue'
you can use
import HelloWorld from '@/components/HelloWorld.vue'
Use icons from any icon set, one syntax for all icons: Material Design Icons, Bootstrap Icons, Font Awesome, etc. All icons libraries are available powered by iconify and unplugin-icons. And don't worry, only the icons you use would be included in the final bundle, keeping the production build lightweight.
The usage is simple, if you want for instance a Material Design Icon (mdi) with name "thumb-up", then just place this inside your template:
<i-mdi-thumb-up />
Just by placing it, the unplugin-icons/resolver
would look for the corresponding icon and in case the related iconify icon set is not installed, it would automatically install it using npm
, e.g. @iconify-json/mdi
.
The convention to use icons is as follows:
{prefix}-{collection}-{icon}
Where the prefix
is "i", the collection
is the collection ID from https://icon-sets.iconify.design/, and finally the icon
is the icon name.
See:
Route changes are animated. By default, the fade
transition will be used unless an alternative is specified in the route meta.
The fade
and slide-fade
transitions are available. You can specify the transition in the page's SFCs like this:
<route lang="yaml">
meta:
transition: slide-fade
</route>
NOTE: Transitions are not triggered between routes of the same type, therefore changing the parameters of the active route won't cause a route transition. This could be changed by using the
route.fullPath
instead ofroute.name
as the key in RouterViewTransition.vue. More info: https://stackoverflow.com/a/70042452/4873750.
Route transitions can be deactivated by changing the provided
enable-route-transitions
value in main.ts.
See:
This project comes with the recommended Eslint configuration for Vue 3 plus integration with Prettier. Prettier helps formatting code while Eslint helps catching bugs in development.
When opening the project in VSCode, it will ask the developers to install Eslint and Prettier, because that way the VSCode settings.json will work and therefore both Prettier and Eslint fix will be executed when saving a file.
Aditionally, commands to lint, check and autoformat code are available in the scripts of package.json
See:
Manually creating an API client is hard to maintain and time demanding, but thanks to OpenAPI and its generators we can now generate the entire API client from an OpenAPI Spec
.
To do so just place your spec in spec/schema.yml
, then run:
npm run gen-api
Which would generate the API client in Typescript and place the generated code in src/api-client
.
NOTE: This command requires
java
to be installed, because the OpenAPI generator is built with it, if you want to avoid asking all developers to install ajvm
and run this command by themselves, just run it once you change the OpenAPI spec, and commit the generated code, for that you need to remove the/src/api-client
line from the.gitignore
. The reason we exclude the generated client by default if because it can always be generated from the spec (spec/schema.yml
), and because the spec file is actually versioned, then the code reviewing is improved by checking only spec changes and not the generated code that nobody wrotes.
INFO: If you have a Mac with an M1 Chip, this page have the correct
OpenJDK
installers for you: https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit
To use the generated APIs just initialize them and make it available for the rest of the application. The following is an example using Swagger Demo PetStore API:
// "api/index.ts"
import { PetApi } from '@/api-client'
export const petApi = new PetApi()
You can also configure the APIs parameters like basePath
and provide your own axios
instance with interceptors configured like this:
// "api/index.ts"
import { PetApi } from '@/api-client'
import { Configuration } from '@/api-client/configuration'
import axiosInstance from './axios'
// See Vite env vars: https://vitejs.dev/guide/env-and-mode.html
const config = new Configuration({ basePath: import.meta.env.BASE_URL })
export const petApi = new PetApi(config, undefined, axiosInstance)
Then in your Vue Components:
<!-- "pages/home.vue" -->
<script setup lang="ts">
import { petApi } from '@/api'
import { Pet, PetStatusEnum } from '@/api-client'
import { ref } from 'vue'
const pets = ref<Pet[]>()
const loading = ref(false)
async function testOpenAPI() {
loading.value = true
const { data } = await petApi.findPetsByStatus({ status: [PetStatusEnum.Available] })
pets.value = data.slice(0, 10)
loading.value = false
}
</script>
See:
The auth system consist on three main parts:
The plugin is installed in Vue's globalProperties
with the name $auth
, it includes an isAuthenticated
property, an user
object, an accessToken
plus the login
and logout
functions. It can be used in templates like this:
<span v-if="$auth.isAuthenticated">
Authenticated as <b>{{ $auth.user.email }}</b>
<button @click="$auth.logout">Logout</button>
</span>
<span v-else>Not Authenticated</span>
The auth
instance is created using the composition API, therefore we can alternatively retrieve it outside of components with the useAuth
function:
import { useAuth } from './useAuth'
const auth = useAuth()
if (auth.isAuthenticated) {
console.log(auth.userFullName)
}
<script setup lang="ts">
import { useAuth } from './useAuth'
import { watchEffect } from 'vue'
const auth = useAuth()
watchEffect(() => {
console.log(auth.isAuthenticated)
})
</script>
Aditionally, the auth plugin can be inspected in the Vue's Devtools panel when having the extension in the browser. The plugin's values are displayed when inspecting any component.
The navigation guards protects pages from non-authenticated users and redirect them to the login page, by default all pages but the login
page are protected.
In order to make a page available for non-authenticated users, a route meta boolean called public
needs to be configured in the page. E.g:
<!-- pages/index.html -->
<route lang="yaml">
meta:
public: true
</route>
The navigation guards can be disabled by changing the autoConfigureNavigationGuards
when configuring the auth system:
// main.ts
import { createApp } from 'vue'
import { createAuth } from './auth'
import App from './App.vue'
import router from './router'
const auth = createAuth({
router,
loginRouteName: 'login',
autoConfigureNavigationGuards: false,
})
const app = createApp(App)
app.use(router)
app.use(auth)
The axios interceptors helps appending auth information to requests and responses of APIs.
The main interceptor adds the Authorization
header with a value of Bearer the-token-value
to all authenticated requests.
This can be configured and disabled in the createAuth
options:
// api/axios.ts
import axios from 'axios'
const axiosInstance = axios.create()
export default axiosInstance
// main.ts
import { createApp } from 'vue'
import { createAuth } from './auth'
import App from './App.vue'
import router from './router'
import axiosInstance from './api/axios'
const auth = createAuth({
router,
axios: {
instance: axiosInstance,
autoAddAuthorizationHeader: true, // default: false
authorizationHeaderPrefix: 'Token', // default: 'Bearer'
},
})
const app = createApp(App)
app.use(router)
app.use(auth)
See:
The vue-i18n
package is used as the internationalization system.
All translation files located in the locales
dir are loaded automatically with the corresponding language code obtained from the file name, e.g. locales/es.json
-> lang code: es
.
How to use it?
Put the texts in the original language inside the function of vue-i18n, for example:
<!-- Single or double quote, and template literals -->
<p>{{ $t('Hello World') }} {{ $t("Hello, how are you?") }} {{ $t(`Hey. I'm watching you!`) }}</p>
<!-- *Note: to be able to use it in tags or when we send text to a component, we must use the single quote format
and bind it to the attribute. -->
<MyComponent :text="$t('example text')" />
<b-form-input v-model="name" type="text" :placeholder="$t('Name')"></b-form-input>
// In TS:
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
t('This is an example')
</script>
You may have noticed that we don't use translations keys like: greetings.hello
, the reason is that defining keys is a troublesome task, and keys doesn't always show what we want to display, take this translation file for example:
// es.json
{
"greetings": {
"hello": "Hola, ¿cómo estás?."
}
}
And the corresponding translation usage:
// Component.vue
t('greetings.hello')
By just looking at the translation key, we won't know what the original text was, now look a this example:
// es.json
{
"Hello, how are you?": "Hola, ¿cómo estás?."
}
// Component.vue
$t('Hello, how are you?')
Better right?, we can directly see the original text, and it's much simpler to translate, we also won't need to define keys because the original text is the key!.
Browser language detection
The default language would match the language of the browser, in case the language is not supported by the application, the fallback language en
would be activated.
Vue i18n extract
Manually extracting the texts from vue or js,ts files is a complex task, we are often lazy to do so or we forget to add them, therefore we lose the sync between the translations files and the source code, that's why we use vue-i18n-extract
, a handy tool that runs static analysis of the source code files and extracts the translation texts from the source code and add them to the translations files like es.json
, en.json
, de.json
, etc. It no only adds the missing keys but also with a command we can remove the no longer used translations.
To extract the keys/original text into the translations files, run:
npm run vue-i18n-extract
This executes the command located in package.json
, which will search for the keys in the vue files given, compare it with the files inside the lang folder and if it finds new words, it will add them.
This script uses the vue-i18n-extract.config.js file for its configuration. This file is located in the root of the project.
Adding a new language:
To add a new language, for instance the German language, just create its file inside the locales
folder using its language code, example: ./locales/de.json
. Then run npm run vue-i18n-extract
to populate the translation keys into that file.
IMPORTANT: When creating the file, make it a valid JSON file, then at least it must has
{}
, otherwise the extraction would fail.
Example:
// locales/es.json
{
}
The file would be loaded automatically by vite
, a vite restart may be needed.
Removing unused translations
In case you want to remove the keys that are in the translation files but are not being used in the vue files, you can run:
npm run vue-i18n-extract-remove
See:
In Heroku create the app, then configure the following buildpacks in the same order:
Config the Heroku remote:
heroku login
heroku git:remote -a <app_name>
Finally, push the changes:
git push heroku main
Author: helixsoftco
Source code: https://github.com/helixsoftco/vuelix
License:
1656741600
Try Logging with the following
Email Address: test@gmail.com
Password: test@12345
At times it get very irritating when you want to start your new project which is a firebase project in which you have to set Authentication Flow EVERYTIME. You have to add Routes, Protect your routes, create a Login & Register component, Style those component and have a nice Loading animation, Validate your login/register form. and much much more.
Here is Vue-Fire-Tail Boiler plate for you😊. Vue-Fire-Tail is powered by next-gen technologies like Vue 3 and Firebase 9 along with the power of Vite and Tailwind CSS v3.
git clone https://github.com/sushil-kamble/vue-tail-fire.git my-project
yarn
Make sure you replace my-project with your own project name
If you don't have yarn installed
npm i
Remove yarn.lock as you will already have package.lock
firebaseConfig object
, We will require its details further. Click on Authetication, then on set up sign-in method. Enable Email/password authentication
& google authentication
..env.local
file in your project's root. Example of .env.local
file is given below. Make sure you replace YOUR_FIREBASE_CONSOLE_DETAILS
with your firebaseConfig object
details.VITE_APP_API_KEY=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_AUTH_DOMAIN=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_DATABASE_URL=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_PROJECT_ID=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_STORAGE_BUCKET=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_MESSAGING_SENDER_ID=YOUR_FIREBASE_CONSOLE_DETAILS
VITE_APP_APP_ID=YOUR_FIREBASE_CONSOLE_DETAILS
yarn dev # OR npm run dev
Auth Required
Auth Required
t-
will be found /src/assets/index.css
, they are basically global stylesSome basic html elements and classes are already configured check out,
/src/assets/index.css
useAuthState
in /src/firebase.js
returns { user, error, isAuthenticated }
useSignOut
in /src/firebase.js
- Signs Out UsergetUserState
in /src/firebase.js
- Returns promiseisValidEmail
/src/helpers/index.js
function returns true if email is validLoading
in /src/components/Loading.vue
- Loading spinnerDialog
in /src/components/Dialog.vue
- Headless UI dialogUbuntu (font-text)
& Goldman (font-heading)
colors.sky["500"]
colors.slate["700"]
.bg-secondary/90
colors.red["500"]
<i class="fas fa-address-book"></i>
then import faAddressBook
in /src/main.js
library
. (See in main.js
)<font-awesome-icon :icon="['fas', 'address-book']" />
Author: sushil-kamble
Source code: https://github.com/sushil-kamble/vue-tail-fire
License:
1656730800
Mocking up web app with Vitesse(speed)
⚡️ Vue 3, Vite 2, pnpm, ESBuild - born with fastness
📲 PWA
🎨 Windi CSS - next generation utility-first CSS framework
😃 Use icons from any icon sets, with no compromise
🔥 Use the new <script setup>
syntax
📥 APIs auto importing - use Composition API and others directly
🖨 Server-side generation (SSG) via vite-ssg
🦔 Critical CSS via critters
🦾 TypeScript, of course
☁️ Deploy on Netlify, zero-config
unplugin-icons
- icons as Vue componentsvite-plugin-pages
- file system based routingvite-plugin-vue-layouts
- layouts for pagesunplugin-vue-components
- components auto importunplugin-auto-import
- Directly use Vue Composition API and others without importingvite-plugin-pwa
- PWAvite-plugin-windicss
- Windi CSS Integrationvite-plugin-md
- Markdown as components / components in Markdownmarkdown-it-prism
- Prism for syntax highlightingprism-theme-vars
- customizable Prism.js theme using CSS variablesvite-plugin-vue-i18n
- Vite plugin for Vue I18n@vueuse/head
- manipulate document head reactively<script setup>
SFC syntaxvite-ssg
- Server-side generation<script setup>
IDE supportAs this template is strongly opinionated, the following provides a curated list for community-maintained variations with different preferences and feature sets. Check them out as well. PR to add yours is also welcome!
Official
Community
Create a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
npx degit antfu/vitesse my-vitesse-app
cd my-vitesse-app
pnpm i # If you don't have pnpm installed, run: npm install -g pnpm
When you use this template, try follow the checklist to update your info properly
name
field in package.json
LICENSE
App.vue
public
.github
folder which contains the funding infoAnd, enjoy :)
Just run and visit http://localhost:3333
pnpm dev
To build the App, run
pnpm build
And you will see the generated file in dist
that ready to be served.
Go to Netlify and select your clone, OK
along the way, and your App will be live in a minute.
I have created several Vite apps recently. Setting the configs up is kinda the bottleneck for me to make the ideas simply come true within a very short time.
So I made this starter template for myself to create apps more easily, along with some good practices that I have learned from making those apps. It's strongly opinionated, but feel free to tweak it or even maintains your own forks. (see community maintained variation forks)
Author: ctholho
Source code: https://github.com/ctholho/vitespa
License: MIT license
1656720000
Opinionated Vite starter template with TailwindCSS
Inspired by Vitesse ❤
⚡️ Vue 3, Vite 2, pnpm, ESBuild - born with fastness
📲 PWA
🎨 Tailwind CSS - Rapidly build modern websites without ever leaving your HTML.
😃 Use icons from any icon sets, with no compromise
🔥 Use the new <script setup>
syntax
📥 APIs auto importing - use Composition API and others directly
🖨 Server-side generation (SSG) via vite-ssg
🦔 Critical CSS via critters
🦾 TypeScript, of course
unplugin-icons
- icons as Vue componentsvite-plugin-pages
- file system based routingvite-plugin-vue-layouts
- layouts for pagesunplugin-vue-components
- components auto importunplugin-auto-import
- Directly use Vue Composition API and others without importing@vueuse/head
- manipulate document head reactivelyvite-plugin-vue-i18n
- Vite plugin for Vue I18nvite-plugin-pwa
- PWA<script setup>
SFC syntaxvite-ssg
- Server-side generation<script setup>
IDE supportCreate a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
npx degit zynth17/vitailse my-vitailse-app
cd my-vitailse-app
pnpm i # If you don't have pnpm installed, run: npm install -g pnpm
When you use this template, try follow the checklist to update your info properly
name
field in package.json
LICENSE
App.vue
public
.github
folder which contains the funding infoAnd, enjoy :)
Just run and visit http://localhost:3000
pnpm dev
Just run and visit https://localhost
pnpm build && pnpm run https-preview
To build the App, run
pnpm build
And you will see the generated file in dist
that ready to be served.
Author: zynth17
Source code: https://github.com/zynth17/vitailse
License: MIT license
1656709200
This template is taken from Mx Space Admin v2 and styled the same way.
Usage
Just use it as a regular template, you can style it in 'configs.json'.
pnpm i
pnpm run dev
UI screenshots
Author: Innei
Source code: https://github.com/Innei/naive-ui-dashboard-template
License:
1656698400
This template should help get you started developing with Vue 3 and Typescript in Vite.
.vue
Imports in TSSince TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can enable Volar's .vue
type support plugin by running Volar: Switch TS Plugin on/off
from VSCode command palette.
Author: snowdreamtech
Source code: https://github.com/snowdreamtech/vite-vue3-tsx-starter
License: MIT license
1656687600
this template includes:
It will help you to create own component
npx degit Houtaroy/vue-component-template my-component
cd my-component
yarn:
yarn
yarn dev
yarn build
pnpm:
pnpm install
pnpm dev
pnpm build
provide a componentUtil to set install
to your component
Author: Houtaroy
Source code: https://github.com/Houtaroy/vue-component-template
License:
1656666000
Deploy your fullstack SSR apps to Cloudflare Workers using Vitedge.
⚡️ Vue 3, Vite 2, ESBuild - born with fastness
⚔️ Edge-side rendering in Cloudflare Workers via Vitedge, with edge cache and HTTP/2 server push
📲 PWA
🎨 Windi CSS - on-demand Tailwind CSS with speed
😃 Use icons from any icon sets, with no compromise
🌍 I18n ready with different routes for each language.
🔥 Use the new <script setup>
style
🦾 TypeScript, of course
☁️ Deploy on Cloudflare Workers, minimal setup
vite-plugin-icons
- icons as Vue componentsvite-plugin-pages
- file system based routingvite-plugin-vue-layouts
- layouts for pagesvite-plugin-components
- components auto importvite-plugin-pwa
- PWAvite-plugin-windicss
- WindiCSS supportvite-plugin-md
- Markdown as components / components in Markdownmarkdown-it-prism
- Prism for syntax highlightingprism-theme-vars
- customizable Prism.js theme using CSS variablesvite-plugin-vue-i18n
- Vite plugin for Vue I18n@vueuse/head
- manipulate document head reactively<script setup>
SFCAs this template is strongly opinionated, the following provides a curated list for community maintained variations with different preferences and feature sets. Check them out as well. PR to add yours are also welcome!
Create a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
npx degit frandiox/vitessedge-template my-vitesse-app
cd my-vitesse-app
npm i
When you use this template, try follow the checklist to update your info properly
name
field in package.json
LICENSE
index.html
public
.github
folder which contains the funding infoAnd, enjoy :)
Just run and visit http://localhost:3333
npm run dev # SSR development
npm run dev:spa # SPA without SSR
To build the App, run
npm run build
And you will see the generated files in dist
, and some of these files will be moved to serverless
for deployment.
account_id
in wrangler.toml. Then:npm run preview # Simulate Worker environment locally
npm run deploy
I have created several Vite apps recently. Setting the configs up is kinda the bottleneck for me to make the ideas simply come true within a very short time.
So I made this starter template for myself to create apps more easily, along with some good practices that I have learned from making those apps. It's strongly opinionated, but feel free to tweak it or even maintains your own forks. (see community maintained variation forks)
Author: frandiox
Source code: https://github.com/frandiox/vitessedge-template
License: MIT license
#vite #vitejs #vue #vuejs
1656655200
A Vite powered WebExtension (Chrome, FireFox, etc.) starter template.
Popup
Options Page
Inject Vue App into the Content Script
<script setup>
syntax and more!webext-bridge
and VueUse storagemanifest.json
with full type supportwebextension-polyfill
- WebExtension browser API Polyfill with typeswebext-bridge
- effortlessly communication between contextsunplugin-auto-import
- Directly use browser
and Vue Composition API without importingunplugin-vue-components
- components auto importunplugin-icons
- icons as componentsvite-plugin-windicss
- WindiCSS support<script setup>
SFC syntaxCreate a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
If you don't have pnpm installed, run: npm install -g pnpm
npx degit antfu/vitesse-webext my-webext
cd my-webext
pnpm i
src
- main source.contentScript
- scripts and components to be injected as content_script
background
- scripts for background.components
- auto-imported Vue components that are shared in popup and options page.styles
- styles shared in popup and options pageassets
- assets used in Vue componentsmanifest.ts
- manifest for the extension.extension
- extension package root.assets
- static assets (mainly for manifest.json
).dist
- built files, also serve stub entry for Vite on development.scripts
- development and bundling helper scripts.pnpm dev
Then load extension in browser with the extension/
folder.
For Firefox developers, you can run the following command instead:
pnpm start:firefox
web-ext
auto reload the extension when extension/
files changed.
While Vite handles HMR automatically in the most of the case, Extensions Reloader is still recommanded for cleaner hard reloading.
To build the extension, run
pnpm build
And then pack files under extension
, you can upload extension.crx
or extension.xpi
to appropriate extension store.
This template is originally made for the volta.net browser extension.
This is a variant of Vitesse, check out the full variations list.
Author: antfu
Source code: https://github.com/antfu/vitesse-webext
License: MIT license
1656637200
Logo created with Windcss logo + Icons made by Vectors Market & Pixel perfect from www.flaticon.com
Vitesome 🌬 ⛵️
A simple opinionated Vue Starter Template with Vite.js
This template should help get you started developing with Vue and Typescript in Vite in a bliss.
This repo brings few things pre-packed, so you don't need to install them manually everytime.
vite-plugin-components
You can create a repo with this template here
Or if you prefer to do it manually with the cleaner git history
npx degit alvarosabu/vitesome my-vitesome-app
cd my-vitesome-app
pnpm i # If you don't have pnpm installed, run: npm install -g pnpm
yarn
yarn dev
This will serve the app at http://localhost:3260
yarn build
Builds the app for production to the dist
folder.
It correctly bundles Vue in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Visit Netlify and select your repo, select OK along the way, and your App will be live in a minute.
VSCode + Vetur. Make sure to enable vetur.experimental.templateInterpolationService
in settings!
<script setup>
<script setup>
is a feature that is currently in RFC stage. To get proper IDE support for the syntax, use Volar instead of Vetur (and disable Vetur).
.vue
Imports in TSSince TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can use the following:
@vuedx/typescript-plugin-vue
to the plugins section in tsconfig.json
src/shims-vue.d.ts
as it is no longer needed to provide module info to Typescriptsrc/main.ts
in VSCodeAuthor: alvarosabu
Source code: https://github.com/alvarosabu/vitesome
License: MIT license
1656626400
This template should help get you started developing mobile applications with Vue3 and Typescript and Vant in Vite.
yarn install
yarn start
yarn build
yarn lint
yarn generate
Vant uses px
unit by default,You can use tools such as postcss-pxtorem
to transform px
unit to rem
unit.
PostCSS config example:
// .postcssrc.js
module.exports = {
plugins: {
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*'],
},
},
};
you can use tools such as postcss--px-to-viewport to transform px
unit to viewport units (vw, vh, vmin, vmax).
PostCSS config example:
// .postcssrc.js
module.exports = {
plugins: {
'postcss-px-to-viewport': {
viewportWidth: 375,
},
},
};
If the size of the design draft is 750 or other sizes, you can adjust the rootValue
to:
// .postcssrc.js
module.exports = {
plugins: {
// postcss-pxtorem version >= 5.0.0
'postcss-pxtorem': {
rootValue({ file }) {
return file.indexOf('vant') !== -1 ? 37.5 : 75;
},
propList: ['*'],
},
},
};
.vue
Imports in TSSince TypeScript cannot handle type information for .vue
imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue
imports (for example to get props validation when using manual h(...)
calls), you can enable Volar's .vue
type support plugin by running Volar: Switch TS Plugin on/off
from VSCode command palette.
Author: LZHD
Source code: https://github.com/LZHD/vue-vite-h5
License: MIT license
1656615600
This is a starter template for those who want to make a desktop application with web technologies. This template uses the below stack.
Vite.js is a new modern bundler for javascript which is blazing fast and includes many sensible defaults.
Tauri is a new modern technology to turn your web apps into a desktop app for multiple platforms (Windows, MacOS, Linux, android and ios soon). Tauri apps have very small file size and tiny memory consumption.
Vue.js is an incremental frontend framework which is an absolute joy to work with. It has seen very impressive improvements in version 3 including Composition Api, script setup, dynamic css binding and ... .
Vuetify is arguably the best component library for Vue 3 and is currently in alpha stage but will soon be ready for production. Lots of premade components will make your job as application developer easier and more fun.
Vue Global Api globally registers commonly used composition api functions such as ref
, reactive
and ... . makes your script setup
sections cleaner.
Ready your workspace according to tauri. Tauri Getting Started
Clone repository git clone https://github.com/yooneskh/vite-tauri-template app-name
yarn
or npm i
Modify these files according to your app.
index.html
package.json
public/favicon.ico
src/assets/logo.*
src-tauri/tauri.conf.json
yarn serve
launches vite and you can test and develop your app in the browser at http://localhost:8080
.
yarn serve:native
launches vite and configures ynetwork to use tauri for api calls. Use this if you want to test your app in tauri dev mode.
yarn serve:tauri
launches tauri in dev mode and you can see your app in tauri window.
yarn build
builds web application and packages them with tauri in src-tauri/target
yarn build:web
only builds the web application and puts it in ./dist
directory. You should not normally want this. Difference of this web app with the one build with normal yarn build
is that this one uses axios for network calls.
Author: yooneskh
Source code: https://github.com/yooneskh/vite-tauri-template
License:
1656604800
Neutralino.js is a new competitor to Electron.js which is smaller and consumes tiny amount of ram.
Vite.js is the new generation of build tools which loads up extremely fast and provides a lot out of the box.
Vue.js is one of the newest javascript frameworks with extremely lean leanring curve and very fun to work with. Has become exceptionally better in version 3. This template uses Vue.js version 3
This template brings all these together and gives you the starting point to make top notch desktop apps.
cd
into the directoryyarn
npx neu update
name
and description
in package.json
applicationId
, modes.window.title
and cli.binaryName
in neutralino.config.js
title
tag in index.html
public/favicon.ico
public/icons/appIcon.png
yarn serve
starts the dev server of vite in 8080
port. (you can change it in the vite.config.js
)src
yarn serve:neu
builds your app and opens it in the neu
window.yarn build
build the js app and packages it with neu
dist
neu listen
)Author: yooneskh
Source code: https://github.com/yooneskh/vite-neutralinojs-template
License:
1656594000
Opinionated scalable vue boilerplate using vite
Learn the design pattern here
<script setup>
styleCreate a repo from this template on GitHub.
If you prefer to do it manually with the cleaner git history
# clone repository
$ git clone https://github.com/logustra/vivu.git
# open folder vivu
$ cd vivu
# install packages
$ pnpm install
# build and serve with vite dev server
$ pnpm dev
# build docker image and tag it with name nginx
$ docker build . -t nginx
# run docker image nginx with name vivu in port 9900
$ docker run -it -p 9900:80 --rm --name vivu nginx
When you use this template, try follow the checklist to update your info properly
name, description, repository, bugs
field in package.json
LICENSE
.vitebook/config.ts
public
.github
folder which contains the funding infoAnd, enjoy :)
A guide how to create a folder using create-cli
# create new atom component with name loading
$ node create component atoms loading
# create new module with name home and with all types
$ node create module home all
If you like my works, you can cheer me on here 😆
Author: logustra
Source code: https://github.com/logustra/vivu
License: MIT license