Remember to install suggested extensions in StackBlitz, after the installation of the project.
If this approach doesn't work for you, you can always just clone the project and run it locally.
This is a Vue template for quick start of a new project.
Used tools and libraries:
huskyandconventional-commitsfor commit lintingyarnfor dependency managementeslint(with@stylistic/eslint-plugininstead of prettier) for lintingviteas a development server and build tooltypescriptfor type safetytailwindcssfor styling
The template contains also preconfigured:
storybookpiniavue-routervue-i18n
as well as a basic structure:
assets- for styles, fonts, etc.components- for reusable componentscomposables- for reusable logichelpers- for utility functionslayouts- for layout componentslocales- for translationspages- for viewsplugins- for Vue pluginsservices- for API servicesstore- for Pinia storetypes- for typescript types used in the project
Assuming that you have already installed Node.js,
go to the root directory and run the following commands.
# Install globally Yarn package manager
npm install -g yarn
# Install dependencies
yarn run initNote
Remember to scan the project for app_name and replace them with your own values.
Start the app in development mode with hot-reloads
yarn run serve# Build for production
yarn run build:prod
# Build for staging
yarn run build:stagingyarn run preview# Only lint
yarn run lint
# Lint and fix
yarn run lint:fix# Start Storybook
yarn run storybook:dev
# Build Storybook
yarn run storybook:build# Install dependencies for ci
## Helpful when you want to install all dependencies for a CI pipeline,
## reassuring that they are installed exactly as in the `yarn.lock` file.
yarn run ci
# Clean dependencies
## Helpful when you want to reinstall all dependencies.
yarn run cleanAll commands, tips and tricks and documentation about used tools and libraries are in the
DEVELOPMENT.md file.
yarn run build:prod
# or
yarn run build:stagingThe builds are saved in the /dist directory.
The NODE_ENV=production is not supported in the .env file in Vite
Only NODE_ENV=development is supported to create a development build of the project
Vite has also so called Mode, depending on the .env file used for build or a serve command.
Respectively it uses
.envor.env.developmentfile for development mode (serve command).env.productionfile for production mode (build command).env.[mode]file for custom mode (build command with --mode [mode] argument)
If you need some local environment variables, use .env.development.local file.
More about modes here
To make use of it in your code, you can use import.meta.env.MODE variable.
if (import.meta.env.MODE !== 'production') {
console.log('Not the production mode');
}Use VITE_APP_ prefix to expose environment variables to your app
VITE_APP_API_URL=https://api.example.com