Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
119 lines (79 sloc) 2.45 KB
description icon layout title weight
Getting started with a electric project.
Getting Started

Electric CLI


npm i -g electric-cli

Initialize Project

electric init

This will prompt you for a project id and name, then it creates a folder in your current directory with your new electric project.


electric run

This will build your newly created project and start up a development server along with a watch task for quickly making changes.

You can also modify the default port 8888 by running electric run -p 3000.

Project Structure

Here is a basic example of an electric project.

├── electric.config.js
└── src
    ├── layouts
    │   ├──
    │   └──
    ├── pages
    │   ├── docs
    │   │   ├──
    │   │   ├──
    │   │   └── parent
    │   │       ├──
    │   │       └──
    │   └──
    └── site.json


This file provides configuration options to electric. It must always be located in the root directory of your project.

See configuration for more information.


This file contains meta data about your project. Any property can be added to this file. Front matter from all pages is merged with this data and passed to every page as a soy param.


The file structure of layouts is flexible, as soy uses the namespace of every file as an identifier.

All layout files must be a soy template, and the only required layout is

See layouts for more information.


Every file in pages with a .soy or .md extension is rendered to HTML during the build command.

The file structure of pages determines the urls of your pages. For the above example, the file will be located at /docs/parent/child.html after building.

Pages named index will be located at the path of it's parent directory, so pages/docs/ will be available at /docs/.

See pages for more information.