Every component package includes an automated installation script that handles the setup for you.
Installing an Individual Component
After downloading a component package, navigate to your project root directory (where yourpackage.jsonfile is located), extract the package there, and run the install script:
bash# Navigate to your project root
cd /path/to/your/project
# Extract the package in the project root
unzip ~/Downloads/hero.zip
# Navigate into the extracted component directory
cd hero
# Run the installation script
./install.sh
Important: Always extract component packages in your project root directory. The install script needs to be run from within the extracted component folder, but it will copy files to the correct locations (lib/layouts/components/sections/orlib/layouts/components/_partials/) in your project.
After installation completes successfully, you can safely delete the extracted component folder (e.g.,hero/) and the downloaded ZIP file.
The installation script will:
- Verify
nunjucks-components.config.jsonexists in your project root - Read component paths from your configuration
- Check for existing installations and compare versions
- Validate that required dependencies are installed
- Copy component files to the correct locations
- Report any missing dependencies with download links
Example Installation Output
bashπ§ Installing hero v0.0.1...
Checking dependencies...
β Warning: Missing required partials:
β’ text
β’ ctas
β’ image
Download from: https://nunjucks-components.netlify.app/downloads/
Continue installation anyway? (y/n)
If you proceed, the component files will be installed even if dependencies are missing. You can download the required partials later.
Installing the Complete Bundle
The bundle includes a master installation script with two modes: full install and update-only.
Full Install (Default)
Install all components or update your existing subset:
bash# Navigate to your project root
cd /path/to/your/project
# Ensure nunjucks-components.config.json exists (required)
# Create it if you haven't already - see "Required Configuration" above
# Extract the bundle in the project root
unzip ~/Downloads/nunjucks-components.zip
# Run the master installation script from project root
./nunjucks-components/install-all.sh
Important: The install script requiresnunjucks-components.config.jsonin your project root. Create this file before running the installation (see "Required Configuration" in the Getting Started section above).
If you already have components installed, the script will prompt you to choose:
- Install all components - Adds new components, updates existing ones (52 total)
- Update existing components only - Only updates components you already have (skips new ones)
Update-Only Mode
Only update components you're already using:
bash./nunjucks-components/install-all.sh --update-only
# or use the short form:
./nunjucks-components/install-all.sh -u
This mode is perfect for:
- Getting updates for the specific components you use
- Avoiding bloat from components you don't need
- Quick updates when new versions are released
The update-only mode detects installed components by checking formanifest.jsonfiles. Only components with matching names will be updated. For example, if you're using one of the starter projects, approximately 22 components will be detected and updated.
The install script automatically:
- Installs all partials first (resolving dependencies)
- Then installs all sections
- Reports which components were installed/updated and which were skipped
- Provides a summary of the installation
After installation completes, you can clean up:
bash# Remove the extracted bundle folder
rm -rf nunjucks-components
# Optionally remove the downloaded ZIP file
rm ~/Downloads/nunjucks-components.zip