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 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>
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
: Generates a production build of your project and runs it on a NodeJS based web server, for both static and server renderer pages.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
# generate a static build and preview it locally
$ npm run serve
$ yarn serve
To continue learning more about Greenwood, please feel free to browse the other sections of our documentation.