Skip to content
/ spa-starter Public template

πŸ“¦ A starter template for single page applications (SPA)

License

Notifications You must be signed in to change notification settings

wearemd/spa-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Single page application starter is a starter template for single page applications (SPA).
Stack: Babel, minireset.css, Pug, Sass, Vue.js, Vue Router, Webpack.


πŸ“ Table of contents


βš™οΈ Prerequisites

⌨️ Commands

Serve

# Serve site at localhost:3000 with hot reloading

make

πŸ’‘ This command will also install dependencies on first run and when package.json or yarn.lock files are updated.

Build

# Build site for production use

make build

πŸ’‘ This command will also install dependencies on first run and when package.json or yarn.lock files are updated.

Help

# List available commands

make help

πŸ—„οΈ Project structure

.
β”œβ”€β”€ assets                         # ASSETS
β”‚Β Β  β”œβ”€β”€ fonts                      # Font assets
β”‚Β Β  β”‚Β Β  └── .gitkeep               # Tracking an empty directory within Git
β”‚Β Β  β”‚
β”‚Β Β  └── images                     # Image assets
β”‚Β Β      └── unicorn.jpg            # Sample image
β”‚
β”‚
β”œβ”€β”€ sass                           # SASS STYLE
β”‚Β Β  β”œβ”€β”€ dev                        # WIP style for development
β”‚Β Β  β”‚Β Β  └── shame.sass             # WIP style or dirty hacks
β”‚Β Β  β”‚
β”‚Β Β  └── utilities                  # Utilities
β”‚Β Β      β”œβ”€β”€ initial-variables.sass # Variables available in all .vue and .sass files
β”‚Β Β      β”œβ”€β”€ mixins.sass            # Mixins available in all .vue and .sass files
β”‚Β Β      └── transitions.sass       # Vue.js transitions imported in app.vue
β”‚
β”‚
β”œβ”€β”€ src                            # VUE.JS/JAVASCRIPT SOURCE FILES
β”‚Β Β  β”œβ”€β”€ pages                      # Pages
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ index.vue              # Home page
β”‚Β Β  β”‚Β Β  └── page.vue               # Sample page
β”‚Β Β  β”‚
β”‚Β Β  β”œβ”€β”€ router                     # Router
β”‚Β Β  β”‚Β Β  └── index.js               # Vue.js router configuration and initialization
β”‚Β Β  β”‚
β”‚Β Β  β”œβ”€β”€ app.js                     # Vue.js application configuration and initialization
β”‚Β Β  β”œβ”€β”€ app.vue                    # Main Vue.js component
β”‚Β Β  └── index.html                 # HTML index used to render the website
β”‚
β”‚
β”œβ”€β”€ webpack                        # WEBPACK CONFIGURATION PER ENVIRONMENT AND UTILITIES
β”‚Β Β  β”œβ”€β”€ common.js                  # Shared between development and production environments
β”‚Β Β  β”œβ”€β”€ dev.js                     # Development environment
β”‚Β Β  β”œβ”€β”€ prod.js                    # Production environment
β”‚Β Β  └── utils.js                   # Utilities to create a new environment easily
β”‚
β”‚
β”œβ”€β”€ .babelrc                       # Presets and plugins to use, used by Babel
β”œβ”€β”€ .gitignore                     # Files and folders ignored by Git
β”œβ”€β”€ .tool-versions                 # Which version to use locally for each language, used by asdf
β”œβ”€β”€ LICENSE                        # License
β”œβ”€β”€ Makefile                       # Commands for this project
β”œβ”€β”€ package.json                   # JavaScript dependencies, used by Yarn
β”œβ”€β”€ README-header.gif              # README header image
β”œβ”€β”€ README.md                      # Project documentation
└── yarn.lock                      # Tracking exact versions for JavaScript dependencies, used by Yarn

βš™οΈ Constant per environment

Follow these steps if you want to define a constant that can change based on Webpack environment.

Step 1: Set the constant name and default value in package.json (usually for development environment):

"configuration": {
  "definePlugin": {
    "SOME_CONST": "Hello there"
  }
}

Step 2: Override the constant by editing the related webpack/[env].js file:

utils.definePlugin({
  SOME_CONST: "Hello from production"
})

Now you can use this constant in every .vue/.js file inside src and it will change depending on Webpack environment.

🍱 Cache busting

Our strategy for cache busting is to automatically append a .[generated-hash] to each asset file name. You can read more about caching in Webpack documentation.

✍️ Authors

πŸ€œπŸ€› Contributing

Contributions, issues and feature requests are welcome! See the list of contributors who participated in this project.

πŸ“„ License

Single page application starter is licensed under the GNU General Public License v3.0.