Shyam-Chen / Vue Starter
Programming Languages
Projects that are alternatives of or similar to Vue Starter
Vue Starter
๐ฉ A boilerplate for HTML5, Vue, Vue Router, i18n, Tailwind, Windi, Netlify, and Vite.
Table of Contents
- Getting Started
- Key Features
- Dockerization
- Configuration
- Directory Structure
- Microservices
- Frequently Asked Questions
Getting Started
Follow steps to execute this boilerplate.
- Clone this boilerplate
$ git clone --depth 1 https://github.com/Shyam-Chen/Vue-Starter <PROJECT_NAME>
$ cd <PROJECT_NAME>
- Install dependencies
$ yarn install
- Compiles and hot-reloads for development
$ yarn serve
- Compiles and minifies for production
$ yarn build
- Lints and fixes files
File Scope: src/**/*.{vue,js,css}
$ yarn lint
- Runs unit tests
File Scope: src/**/*.spec.js
$ yarn unit
- Runs end-to-end tests
File Scope: src/**/*.e2e-spec.js
$ yarn build
$ yarn preview
$ yarn e2e
- Measure app performance
File Scope: src/**/*.e2e-meas.js
$ yarn build
$ yarn preview
$ yarn meas
- Mock requests
mock/requests
is a fork of Koa-Starter that was made easy and quick way to run mock APIs locally.
$ yarn active
$ yarn mock
Key Features
This seed repository provides the following features:
- ---------- Essentials ----------
- [x] Vue
- [x] Vue Router
- [x] Vue Localer
- ---------- Tools ----------
- [x] Vite
- [x] Windi CSS
- [x] ESLint
- [ ] StyleLint
- [x] Prettier
- [ ] Jest
- [ ] Playwright
- [ ] Lighthouse
- ---------- Environments ----------
- [x] Netlify
- [ ] Capacitor (
git merge capacitor --squash
) - [ ] Electron (
git merge electron --squash
)
Dockerization
Dockerize an application.
- Build and run the container in the background
$ docker-compose up -d default
- Run a command in a running container
$ docker-compose exec default <COMMAND>
- Remove the old container before creating the new one
$ docker-compose rm -fs
- Restart up the container in the background
$ docker-compose up -d --build default
Configuration
Control the environment.
Default environments
Set your local environment variables. (use this.<ENV_NAME> = process.env.<ENV_NAME> || <LOCAL_ENV>;
)
// env.js
function Environment() {
this.API_URL = process.env.API_URL || 'http://localhost:3000';
}
export default new Environment();
Continuous integration environments
Add environment variables to the CircleCI build.
CODECOV_TOKEN=xxx
Continuous deployment environments
Add environment variables to the Netlify build.
API_URL=http://api.example.com
File-based environments
If you want to set environment variables from a file.
.
โโโ envs
โ โโโ dev.js
โ โโโ stage.js
โ โโโ prod.js
โโโ mock
โโโ public
โโโ src
// envs/<ENV_NAME>.js
function Environment() {
this.API_URL = 'http://api.example.com';
}
module.exports = new Environments();
$ yarn add env-cmd -D
// package.json
"scripts": {
// "env-cmd -f ./envs/<ENV_NAME>.js" + "yarn build"
"build:dev": "env-cmd -f ./envs/dev.js yarn build",
"build:stage": "env-cmd -f ./envs/stage.js yarn build",
"build:prod": "env-cmd -f ./envs/prod.js yarn build",
},
SEO friendly
Netlify comes with built-in prerendering. Enabling it is as simple as checking a box:
VS Code settings
The most basic configuration.
{
// ...
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
],
"javascript.validate.enable": false,
"css.validate": false,
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": false,
// ...
}
Directory Structure
The structure follows the LIFT Guidelines.
.
โโโ src
โ โโโ __tests__
โ โ โโโ ...
โ โโโ _<THING> -> app of private or protected things
โ โ โโโ ...
โ โโโ assets -> datas, fonts, images, medias, styles
โ โ โโโ ...
โ โโโ core -> core feature module
โ โ โโโ ...
โ โโโ <FEATURE> -> feature modules
โ โ โโโ __tests__
โ โ โ โโโ <FEATURE>.e2e-spec.js
โ โ โ โโโ <FEATURE>.spec.js
โ โ โ โโโ actions.spec.js
โ โ โ โโโ getters.spec.js
โ โ โโโ _<THING> -> feature of private or protected things
โ โ โ โโโ ...
โ โ โโโ <FEATURE>.vue -> page component
โ โ โโโ actions.js
โ โ โโโ constants.js
โ โ โโโ getters.js
โ โโโ <GROUP> -> module group
โ โ โโโ <FEATURE> -> feature modules
โ โ โโโ __tests__
โ โ โ โโโ <FEATURE>.e2e-spec.js
โ โ โ โโโ <FEATURE>.spec.js
โ โ โ โโโ actions.spec.js
โ โ โ โโโ getters.spec.js
โ โ โโโ _<THING> -> feature of private or protected things
โ โ โ โโโ ...
โ โ โโโ <FEATURE>.vue -> page component
โ โ โโโ actions.js
โ โ โโโ constants.js
โ โ โโโ getters.js
โ โโโ shared -> shared feature module
โ โ โโโ ...
โ โโโ App.vue
โ โโโ Home.vue
โ โโโ main.js -> entrypoint
โโโ .editorconfig
โโโ .eslintrc
โโโ .gitignore
โโโ .prettierrc
โโโ .stylelintrc
โโโ circle.yml
โโโ docker-compose.yml
โโโ Dockerfile
โโโ env.js
โโโ index.html
โโโ jest.config.js
โโโ LICENSE
โโโ netlify.toml
โโโ package.json
โโโ README.md
โโโ vite.config.js
โโโ yarn.lock
Microservices
Techniques, strategies and recipes for building a modern web app with multiple teams that can ship features independently.
See Client-side Micro-Fullstack for instructions on how to create microservices from source.
Frequently Asked Questions
- HTML img src tag not displaying image
<template>
<div>
<img src="~~/assets/images/foo.png" alt="foo" />
</div>
</template>
- CSS background image not displaying
<template>
<div>
<div class="foo"></div>
</div>
</template>
<style scoped>
.foo {
width: 6rem;
height: 6rem;
background: url('~/assets/images/foo.png') no-repeat;
}
</style>
- Vue.js dynamic images not displaying
<template>
<div>
<img :src="require('~/assets/images/foo.png')" alt="foo" />
</div>
</template>