Astro boilerplate for projects by Locomotive.
- PostCSS for a feature rich superset of CSS.
- Tailwind CSS for a sane and scalable CSS architecture.
- Locomotive Scroll for smooth scrolling with parallax effects.
- Swup for versatile and extensible page transitions.
- Oxlint and Oxfmt for a linted, formatted and easy to maintain codebase.
- Nanostores as state manager.
Make sure you have the following installed:
- Node — at least 24.0, the latest LTS is recommended.
- NPM — at least 8.0, the latest LTS is recommended.
💡 You can use NVM to install and use different versions of Node via the command-line.
# Clone the repository.
git clone https://github.com/locomotivemtl/astro-boilerplate.git my-new-project
# Enter the newly-cloned directory.
cd my-new-project# Switch to recommended Node version from .nvmrc
nvm use
# Install dependencies from package.json
npm install# Start development server, watch for changes, and compile assets
npm start
# Compile and minify assets
npm run buildAll commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add, astro check |
npm run astro -- --help |
Get help using the Astro CLI |
npm run check |
Type check, lint and check formatting |
npm run lint |
Lint files using Oxlint |
npm run lint:fix |
Lint files and apply safe fixes |
npm run format |
Format files using Oxfmt |
npm run format:check |
Check formatting without writing |
A commit-msg hook runs commitlint on every commit. The rules are lenient on purpose: no Conventional Commits types, only a clear subject line.
| Rule | Level |
|---|---|
| Subject has at least 2 words | Error |
| Subject is 5 to 100 characters | Error |
| Subject doesn't end with a period | Error |
| Blank line between subject and body | Warning |
If 100 characters isn't enough, keep the subject short and explain in the body.