Registry / web-framework / roots
library5.2.0jsnpmunverified

Roots is a fast, simple, and customizable static site compiler, currently in maintenance mode at version 5.2.0. It offers a flexible build pipeline with support for various preprocessors (Jade, Stylus, CoffeeScript, etc.), automatic asset pipeline, and live reload via Browsersync. Roots is no longer actively developed; the team now maintains Spike, a more modern alternative. Roots compiles static sites with minimal configuration and supports project scaffolding via Sprout. It is best suited for small-to-medium projects that don't require server-side rendering.

npm install roots
INSTALL
IMPORT
SIG · ROOTS
R
roots
web-frameworkjavascriptv5.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import roots from 'roots'
const roots = require('roots')
Roots is typically used as a CLI tool, not imported programmatically. If you must import it, use ESM syntax.
compile function
import { compile } from 'roots'
const { compile } = require('roots')
ESM-only since v5? Actually roots v5 still supports CJS, but ESM is preferred.
Roots class
import Roots from 'roots'
const Roots = require('roots').default
Default export is the Roots constructor. CJS require yields the same object.

Create a new Roots project, add a layout (Jade) and page, a Stylus stylesheet, compile to public/.

<!-- Install globally --> npm install roots -g <!-- Create a new project --> roots new my-project cd my-project <!-- Add a layout and page --> mkdir -p views/layouts cat > views/layouts/default.jade <<EOF !!! html head title My Site body block content EOF cat > views/index.jade <<EOF extends ./layouts/default.jade block content h1 Hello, Roots! EOF <!-- Add a stylus file --> mkdir -p assets/css cat > assets/css/main.styl <<EOF body font-family: sans-serif EOF <!-- Compile --> roots compile <!-- Output in public/ --> ls public/
roots --version
Debug
Known issues
deprecatedRoots is in maintenance mode. No new features will be added. Consider migrating to Spike (https://github.com/static-dev/spike).
fix
Evaluate Spike as a replacement for new projects.
affects: >=5.0.0
breakingroots deploy command removed in v5.0.0. Use ship separately.
fix
Install ship globally: npm i ship -g, then run: roots compile && ship public -to <target>
affects: >=5.0.0
breakingBabel upgraded to v6 in roots v4.0.0. If using Babel, must use Babel 6 or higher.
fix
Update Babel to v6 or remove Babel dependency.
affects: >=4.0.0 <4.0.0
gotchaEACCES permission errors when installing roots globally on macOS/Linux.
fix
Either use nvm or change npm global directory: see https://roots.cx/docs/error#eacces-permission-denied
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'roots'
Roots not installed or global module not in PATH.
fix
Install globally: npm install -g roots
Roots: command not found
Roots not installed globally or npm bin not in PATH.
fix
Install globally: npm install -g roots; ensure npm global bin is in PATH.
Error: Cannot find module 'jade'
Missing Jade dependency for .jade files.
fix
Install jade locally: npm install --save-dev jade; or use Pug (rename to .pug and install pug).
Upgrade
Version history
5.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
roots — npm install roots · libregistry