Documentation

This is the documentation space for Greenwood that we hope will help you get the most out of using it. If this is your first time with Greenwood, we recommend checking out our Getting Started guide to get more familiar with setting up your first Greenwood project.

Installation

Greenwood can be installed with any of the common package managers available today.

# npm
$ npm install @greenwood/cli --save-dev

# yarn
$ yarn add @greenwood/cli --dev

Though we recommend installing it locally to your project, you can also run Greenwood globally. For global usage we recommend using npx

$ npx @greenwood/cli@latest <command>

CLI

With Greenwood installed, you can run its CLI to generate your site. The principal commands available are:

  • greenwood develop: Starts a local development server for your project.
  • greenwood build: Generates a production build of your project for just static assets.
  • greenwood serve: Starts a server to host the output of the Greenwood build command with NodeJS. For convenience on your host, this can be achieved with npx @greenwood/cli serve.
    • For SSG, you only need the public/ output directory.
    • For SSR, you need the public/ output directory and the project's greenwood.config.js file (if applicable).
  • greenwood eject: Ejects CLI configurations (Just Rollup right now) to your working directory for more advanced customization. YMMV.

You can define npm scripts in package.json like so to automate your workflows. You also need to define a type field with the value of module:

{
  "type": "module",
  "scripts": {
    "build": "greenwood build",
    "start": "greenwood develop",
    "serve": "greenwood serve"
  }
}

Then from the command line you can use npm or Yarn to run them:

 # start up the dev server
$ npm start
$ yarn start

# generate a static build to deploy
$ npm run build
$ yarn build

# serve a static build
$ npm run serve
$ yarn serve

Note: You must have run greenwood build before running greenwood serve. Except for Context plugins, plugins are generally not available with greenwood serve as your application is built ahead of time.

Sections

To continue learning more about Greenwood, please feel free to browse the other sections of our documentation.

  • Component Model: Examples of using custom elements in Greenwood.
  • Configuration: Available configuration options for the Greenwood CLI.
  • Front Matter: Page level configurations through page markdown.
  • Markdown: Using markdown and related authoring capabilities supported by Greenwood.
  • Styles and Assets: How to style and theme your project with CSS.
  • Templates: Controlling the layout of your pages.
  • Tech Stack: What's under the hood.