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.
Greenwood can be installed manually with any of the common package managers available today or you scaffold a new project through our init
package.
# 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>
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
.
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 runninggreenwood serve
. Except for Context plugins, plugins are generally not available withgreenwood serve
as your application is built ahead of time.
To continue learning more about Greenwood, please feel free to browse the other sections of our documentation.