Static site starter is a starter template for static sites.
Stack:
Babel,
Browsersync,
Gulp,
minireset.css,
Pug,
Sass,
Webpack.
- Prerequisites
- Commands
- Project structure
- Layout structure
- Cache busting
- Setting meta tags
- Authors
- Contributing
- License
## Serve site at http://localhost:3000 with live 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
.
βββ documentation-images # PROJECT DOCUMENTATION IMAGES
β
β
βββ gulp # GULP/WEBPACK CONFIGURATION AND TASKS
β βββ env # Gulp configuration per environment
β β βββ dev.js # Development environment
β β βββ prod.js # Production environment
β β
β βββ helpers # Gulp helpers
β β βββ url.js # Helper for URL creation
β β
β βββ tasks # Gulp tasks
β β βββ pug.js # Pug task declaration
β β βββ sass.js # Sass task declaration
β β βββ script.js # JavaScript task declaration
β β
β βββ webpack # Webpack configuration per environment
β β βββ common.js # Shared between development and production environments
β β βββ dev.js # Development environment
β β βββ prod.js # Production environment
β β
β βββ index.js # Script to invoke proper environment and dynamically load Gulp tasks
β
β
βββ js # JAVASCRIPT SOURCE FILES
β βββ foo.js # Sample script imported in scripts.js
β βββ scripts.js # Main JavaScript file used as entry by Webpack
β
β
βββ 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
β β βββ _all.sass # Importing all stylesheets
β β βββ animations.sass # Some basic animations
β β βββ functions.sass # Functions
β β βββ mixins.sass # A few useful mixins
β β βββ variables.sass # Variables for colors, typography, etc.
β β
β βββ style.sass # Main Sass file used as source by Gulp
β
β
βββ site # SITE BUILD DESTINATION FOLDER
β βββ fonts # Font assets
β β βββ roboto # Roboto from Google Fonts (TTF, WOFF, WOFF2)
β β
β βββ images # Image assets
β βββ favicon.ico # Favicon (placeholder by default)
β βββ og-image.jpg # Image for og:image meta tag (placeholder by default)
β βββ unicorn.jpg # Sample image
β
β
βββ templates # PUG TEMPLATES
β βββ layouts # Layouts
β β βββ default.pug # Default layout
β β
β βββ partials # Partials
β β βββ unicorn.pug # Sample partial featuring an image
β β
β βββ index.pug # Home page
β βββ page.pug # Sample page
β
β
βββ .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
βββ gulpfile.js # Gulp configuration
βββ 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 style.sass
if you want to use it.
Our strategy for cache busting is to automatically append a ?v=[version]
to each asset query. When you need to bust the cache, simply update version
in package.json
.
In Pug templates an assetVersion
variable is available. Usage:
img(src="images/unicorn.jpg" + assetVersion, alt="")
In Sass files an urlVersion
function is available. Usage:
background-image: urlVersion("/images/unicorn.jpg")
It is required to do some configuration to get title
, description
and og:
meta tags ready for production. You can read more about OG meta tags in the Open Graph protocol documentation.
Step 1: Set the following variables in default.pug
:
- var siteTitle = "Site title";
- var siteDescription = "Site description";
- var baseUrl = "https://site-url.com";
Step 2: Set pageTitle
variable for each page. For example in index.pug
:
- pageTitle = "Home";
Step 3: Customize the OG image.
- @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.
Static site starter is licensed under the GNU General Public License v3.0.