# Getting Started
# Vue Boilerplate
A fork of the boilerplate produced by Vue CLI 3, the root project folder consists public, src and script folders. Download Vue CLI 3 with global bridge
npm install -g vue-cli
npm install -g @vue/cli-init
Check the installed version of Vue CLI
vue --version
# Create a new project (multi module)
In order to create a new project with existing boilerplate, run below command
vue init e9-devops/vue-boilerplate .
# public
All the html files, favicons are stored at public level. If you have any static lottie or animation files, they can be stored in public folder too.
# src
src folder consists of all the source code related to the project which has been divided into following folders.
- assets
- mixins
- models
- plugins
- scss
- services
- webapp
assets
: All the static files which can be served through the server are stored here. ex. images, videos etc.models
: model files consisting the schemas of entities.scss
: scss files with their mixinsplugins
: All third party plugins should be imported inplugins/index.js
.services
: All model level services are stored under services folder. API Calls must be done via services.webapp
: This folder has the actual modules of the project including routes, components, stores etc.
# vue.config.js
All the webpack configurations must exist in this file. Boilerplate is well equipped with gzip compression and code splitting at build time.
pages can have as many modules as project requires. Every object requires an entry point (main.js
) from where app instance of Vue is initialised, a template with index.html
& $el
. filename
property is related to final build the cli generates in /dist
folder
# Environment files
Boilerplate ships with three different env files
- .env
- .env.staging
- .env.production Make sure to supply relevant API keys and endpoints depending on the environment.
# Commands
npm run server
: runs the development servernpm run build
: builds the production distributionnpm run staging
: builds the staging distributionnpm run lint
: runs the linter and returns errors, doesn't fix itnpm run lint-fix
: runs the linter and automatically fix the fixable errorsnpm run deploy:prod
: deploys the dist folder to production environmentnpm run deploy:staging
: deploys the dist folder to staging environmentnpm run changelog
: generates the changelog based on git tags and package.json version. Check for more informationnpm run postpublish
: commits the changelog with ci skip message. Add version tag to the commit before pushing.
TIP
Make sure to keep login page as it is, if login is a separate page. Keeping login separate adds an abstraction layer on the original part of the app and increases the loading time of the login page.
# Vue Components
Via npm
npm install --save @e9ine/vue_components
# Setup
Import the components you’d like to use in your local component. Then define the components in a components option:
import {ComponentA} from '@e9ine/vue_components'
export default {
components: {
ComponentA
},
// ...
}
Refer Theming Options for the available options to import the scss files.