Always read the
README.md file shipped in a template so that you always get things to work properly.
Start a new project
Now we're ready, let's start a new project using Fable!
Download a Fable sample
The most common way is to download the Fable suite of samples using
git clone https://github.com/fable-compiler/fable2-samples.git. There are several samples ready to use. Each located in its own folder.
Browser app with fetch & promises & json parsing using .paket manager to resolve .NET dependencies (withpaket)
Install JS dependencies
The JS dependencies are located in the package.json file. Since we're using JS libraries, we'll need to install them
- using npm:
It will create a
node_modulesfolder and a
A note about lock files
Lock files like
package-lock.json, if you're using npm should be committed to ensure reproducible builds whenever anybody clones the repo.
- using npm:
Build & Run & Update the app
Now we're done the dependencies, let's start our app in watch mode. Depending on the kind of template the instructions my differ.
For a web app, unless advised, it will always be
Then you'll be able to access your project from http://localhost:8080/. So it's time to open this address in your favorite browser.
If you now open the project with your favourite code editor, you can make some changes in the
App.fsfile located in the
srcfolder. Save the changes and if compilation succeeds you should be able to see your changes directly in your browser.
For a Node.js app, unless advised, it will always be
Then you'll be able see the generated JS files in the