Git Product home page Git Product logo

vuejs-boilerplate's Introduction

Real World Vue.js Boilerplate

This project based on real world practice and ready to use. Have a fun!

Features

  • Http request class that implements API calls with Auth and tokens refresh based on Axios
  • Data access layer/API calls
  • Response wrapper/Response error wrapper
  • Base common and layout components
  • Some help mixins

Project structure

index.html

Main index HTML file.

src

Source =)

assets

Images/Fonts/Other media stuff.

components

Shared components folder.

config

App config files.

directives

Directives.

layout

Base app layout components.

mixins

  • One mixin per file principle
  • Local(not global) mixin filename === mixin method/prop name principle (setModelMixin.js === setModelMixin)
  • Global mixins names from $ principle

pages

Page wrapper components(Pages) and Local components.

router

Router instance and routing declaration.

scss

Style files(partials, variables, mixins, reset).

services

Data access layer/API calls. API calls must be represented in separate classes (not in vuex action).

store

App store and modules.

.env.js

Environment variables (add this to git ignore).

app.init.js

Root app initialization file.

global.helpers.js

Add global helpers to window object.

Checkpoints

Where app initialize current user state ?

/src/router/index.js >> initCurrentUserStateMiddleware. Each time app loads middleware check refresh token and fetch current user if token exist.

Where app check access permissions ?

/src/router/index.js >> checkAccessMiddleware. Each time user change route, app check permissions to route.

How to declare global SCSS variables/mixins etc... ?

In /build/utils.js >> generateLoaders('sass')

Utils/Helpers

What about debounce ?

import debounce from '../directives/debounce'
directives: {
  debounce
}

And use it in template.

<input type="text" v-model="name" v-debounce="500" @debounce-change="runSomeMethod">

Build Setup

# clone repo
git clone https://github.com/zmts/vuejs-boilerplate.git

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

vuejs-boilerplate's People

Contributors

zmts avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.