Eleventy is a simpler static site generator, which does a beautiful job of scaffolding your static site. However, a web application is so much more; what about images, stylesheets, or scripts? This is where Parcel, a zero configuration web application bundler, comes in. By combining Eleventy with Parcel, you can take your static site to the next level with minimal effort.
This project is set-up as a Template Repository. Click the "Use this template" button to create your new static site from this repository.
- Clone the repository using
git clone https://github.com/vseventer/eleventy-parcel-boilerplate.
- Navigate to your project directory using
- Install the dependencies using
This project supports both
yarn, feel free to use whichever package manager you're most comfortable with.
By default, Parcel will mark all files in your top-level source directory as entry points of your static site. Typically, these are your
CNAME. This project assumes all other pages of your static site are referenced by any of these entry points, and Parcel will pick them up automatically.
- To start the development server, run
npm run watchand navigate to
- To build your site just once (for production), run
npm run build.
This project predefines a set of configuration files, which can be tweaked depending on your preferences.
browserslist property reflects the browsers your static website supports, per browserslist.
homepage property should reflect the URL of your production site. If you prefer to use absolute URLs, remove the
--public-url $npm_package_homepage flag from the
parcel:build npm script.
config block in
package.json enumerates three directories:
input: the source of your web application.
intermediate: the output directory for Eleventy, and input directory for Parcel. You should never directly modify contents in this directory.
output: the final build of your web application.
Linting is ran on your configuration files, as well as the scripts in the source directory of your static site.
The Eleventy configuration file adds support for running a staging environment, useful for Forestry integration. The development server is also updated to redirect 404 routes to your
404.html page (if present in your project).
In addition, it sets some sane defaults, as well as provide a boilerplate for how to add custom filters and tags. This project comes with two, a
debug filter, and
link custom Nunjucks tag.
The PostHTML configuration adds a custom plugin to your pipeline, required to make Eleventy and Parcel play nice together. Do not remove this plugin unless you know what you are doing, or want your build to break.
Parcel does not have a separate configuration file, but does pick-up on packages named
parcel-plugin-*. Included with this project are:
parcel-plugin-eslint: required to run linting before building with Parcel.
parcel-plugin-keep-asset-folders: recommended if you want to keep your assets source directory structure rather than storing them all in the top-level output folder.
parcel-plugin-remove-index-html: highly recommended if you want your final build to have nice URLs (
Content of your site lives in the
src/ directory by default.
If you are using Forestry to manage your content, import your site by following the steps in the Forestry Dashboard. This project is set-up so that the Instant Preview functionality of Forestry will work out of the box.
- parceleventy (not actively maintained)
The MIT License (MIT) Copyright (c) 2019 Mark van Seventer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.