Single page application starter is a starter template for single page applications (SPA).
Stack:
Babel,
minireset.css,
Pug,
Sass,
Vue.js,
Vue Router,
Webpack.
- Prerequisites
- Commands
- Project structure
- Constant per environment
- Cache busting
- Authors
- Contributing
- License
# 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 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.
# List available commands
make help
.
βββ 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
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.
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.
- @Awea - Idea and initial work
- @mmaayylliiss - Design, code/documentation review
Contributions, issues and feature requests are welcome! See the list of contributors who participated in this project.
Single page application starter is licensed under the GNU General Public License v3.0.