SPA starter is a starter template for single page applications.
Stack:
esbuild,
minireset.css,
Pug,
Sass,
Vue.js,
Vue Router,
Webpack.
- Prerequisites
- Commands
- Project structure
- Layout structure
- Constant per environment
- Cache busting
- Authors
- Contributing
- License
## Serve site at http://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
β β βββ roboto # Roboto from Google Fonts (TTF, WOFF, WOFF2)
β β
β βββ images # Image assets
β βββ favicon.ico # Favicon (placeholder by default)
β βββ unicorn.jpg # Sample image
β
β
βββ documentation-images # PROJECT DOCUMENTATION IMAGES
β
β
βββ sass # SASS STYLE
β βββ base # Base style
β β βββ _all.sass # Importing all stylesheets
β β βββ generic.sass # Style for generic elements (html, body, etc.)
β β βββ helpers.sass # Helper classes (modifiers)
β β
β βββ dev # Development utilities
β β βββ shame.sass # WIP style or dirty hacks
β β βββ structure.sass # Highlighting site structure (import commented by default)
β β
β βββ fonts # Fonts style
β β βββ _all.sass # Importing all stylesheets
β β βββ roboto.sass # @font-face style for Roboto
β β
β βββ layout # Layout style
β β βββ _all.sass # Importing all stylesheets
β β βββ layout.sass # Very light starter style for structure elements and titles
β β
β βββ utilities # Utilities
β βββ animations.sass # Some basic animations
β βββ mixins.sass # A few useful mixins (available in all .vue and .sass files)
β βββ transitions.sass # Vue.js transitions (imported in app.vue)
β βββ variables.sass # Variables for colors, typography, etc. (available in all .vue
| # and .sass files)
β
β
βββ 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
β
β
βββ .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.md # Project documentation
βββ yarn.lock # Tracking exact versions for JavaScript dependencies, used by Yarn
The starter comes with a simple layout, structured like the following:
// Wrapper
.wrapper
// Header
header.header
.container
β¦
// Main
main.main
// Section (repeatable)
section.section
.container
β¦
// Footer
footer.footer
.container
β¦
There is also a Sass utility allowing to highlight the site structure (pretty useful in development). Simply uncomment @import "dev/structure.sass"
in app.vue
if you want to use it.
Follow these steps if you want to define a constant that can change based on Webpack environment.
Step 1: Declare the constant 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.
SPA starter is licensed under the GNU General Public License v3.0.