Prerequisites
Saber requires Node.js 8 or above.
When you have Node.js installed on your machine, the node
and npm
commands will be available in your terminal.
Run following command to check your Node.js version:
node -v
Creating a New Project from Scratch
Creating a new directory my-site
and populate a package.json
:
mkdir my-site
cd my-site
npm init -y
Install Saber with npm:
npm install saber
Alternatively, you can also install Saber with Yarn which is an alternative package manager developed by Facebook:
yarn add saber
Make sure you have Yarn installed first.
Configure scripts
in package.json
:
{
"scripts": {
"dev": "saber",
"build": "saber build"
}
}
Then you can run npm run dev
to start the dev server, or run npm run build
to create a production build of your app.
Using the Generator
You can also generate a new site with just a single command:
npm init site my-site
Or using Yarn:
yarn create site my-site
Then start the dev server:
cd my-site
npm install
npm run dev
For more details, check out the README.md
in my-site/
.
CodeSandbox Example
The easiest way to try out Saber is to edit and preview the example project on CodeSandbox.