Deploy Eleventy with Bantam CLI
A simpler static site generator with powerful features
Quick start:
# Build your Eleventy app
npx @11ty/eleventy
# Deploy it
bantam deploy _site
Quick Start
Install dependencies
Install Eleventy and project dependencies
npm install
Build your site
Generate static HTML from your templates
npx @11ty/eleventy
Deploy with Bantam
Your Eleventy site is now live!
bantam deploy _site
Framework Details
Eleventy Configuration
Configure Eleventy for your project:
.eleventy.js:
module.exports = function(eleventyConfig) {
// Copy static assets
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPassthroughCopy("src/css");
// Watch CSS files for changes
eleventyConfig.addWatchTarget("src/css/");
// Add filters
eleventyConfig.addFilter("dateDisplay", (dateObj) => {
return new Date(dateObj).toLocaleDateString();
});
return {
dir: {
input: "src",
output: "_site",
includes: "_includes",
layouts: "_layouts"
},
templateFormats: ["md", "njk", "html"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk"
};
};
Data Cascade
Use Eleventy's data cascade for dynamic content:
Global data file (_data/site.json):
{
"name": "My Site",
"url": "https://mysite.bantam.host",
"description": "An Eleventy site"
}
Use in templates:
---
title: {{ site.name }}
---
<h1>{{ title }}</h1>
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
Build Output
Eleventy generates files based on your input structure:
index.html
- From index.md or index.njkabout/index.html
- Clean URLs by defaultblog/post-name/index.html
- From markdown filesassets/
- Copied via passthroughfeed.xml
- If configured with plugin
Advanced Usage
Custom Domain
Deploy directly to your own domain
bantam deploy ./dist --domain myapp.com
Permanent Deployment
Keep your site online forever (requires login)
bantam deploy ./dist --permanent
Custom Expiry
Set how long your deployment stays online
bantam deploy ./dist --expiry-days 7
Custom Subdomain
Choose your own subdomain on bantam.site
bantam deploy ./dist --subdomain my-project
CI/CD Integration
Add Bantam to your continuous deployment pipeline:
# GitHub Actions example
- name: Deploy to Bantam
run: |
npm install -g @bantamhq/cli
bantam login --token ${{ secrets.BANTAM_TOKEN }}
bantam deploy ./dist --domain myapp.com --permanent
Common Issues & Solutions
Quick fixes for deployment challenges
01.Template not found errors?
Check your template paths and extensions:
// .eleventy.js
return {
dir: {
input: "src",
includes: "_includes", // Relative to input
layouts: "_layouts" // For layout templates
},
templateFormats: ["md", "njk", "html", "liquid"]
};
02.Assets not copying to output?
Add passthrough copy for static files:
// .eleventy.js
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/css");
eleventyConfig.addPassthroughCopy("src/js");
eleventyConfig.addPassthroughCopy("src/favicon.ico");
// Or copy everything in assets
eleventyConfig.addPassthroughCopy("src/assets");
03.Data files not loading?
Ensure data files are in the correct location:
// Default data directory: _data/
src/
_data/
site.json // Available as {{ site }}
nav.js // Can export functions
posts/
posts.json // Directory data files
JavaScript data files can be dynamic:
// _data/build.js
module.exports = {
timestamp: new Date(),
env: process.env.NODE_ENV
};
04.Pagination not working?
Set up pagination in your template front matter:
---
pagination:
data: collections.posts
size: 10
alias: posts
permalink: "/blog/page-{{ pagination.pageNumber + 1 }}/"
---
{% for post in posts %}
<article>{{ post.data.title }}</article>
{% endfor %}
05.Build performance issues?
Optimize Eleventy builds:
// .eleventy.js
// Use incremental builds
eleventyConfig.setIncrementalBuild(true);
// Ignore files during serve
eleventyConfig.ignores.add("README.md");
eleventyConfig.ignores.add("node_modules/**/*");
// Set quiet mode for faster builds
eleventyConfig.setQuietMode(true);