formality-loader
formality-loader
compiles imported Formality files into a JavaScript module.
Install
With webpack correctly installed, add formality-loader
and formality-lang
as dependencies:
$ npm install formality-loader formality-lang --save-dev
Then add the loader to your webpack
config file:
webpack.config.js
const formalityResolver = resolver moduleexports = resolve: plugins: formalityResolver module: rules: test: /\.fm$/ loader: 'formality-loader' options: typeCheckMode: 'all' // Options: all, none, production, development. Default: all
Using
In your JavaScript file, import (or require) your Formality files including the .fm
extension.
src/index.js
console
src/App.fm
import Base# main(n: Number) : Number 2 .*. n
Check the example folder for more info.