Liferay Elm Generator
A Yeoman generator for creating Liferay Elm projects, using the amazing Create Elm App for a fast and easy development with no build configuration. To create a build for Liferay, it uses the liferay-npm-bundler
from the very useful Liferay JS Toolkit.
Installation
Node >=10 is required for installation.
First, install Yeoman and generator-liferay-elm using npm (assuming you have pre-installed node.js).
npm install -g yo generator-liferay-elm
Then generate your new project:
yo liferay-elm
You can also try it locally by cloning the repo and running
npm link
inside the project.
Getting started
Once the project generated:
cd my-elm-project
yarn start
Where
my-elm-project
is the default name provided by the generator. Change it accordingly to the name you choose.
If you choose the pre-configured Liferay Docker environment, you might want to start it with:
docker-compose up -d
Build your app for Liferay:
yarn build:liferay
Deploy your app to Liferay:
yarn deploy:liferay
Run tests:
yarn test
# or in watch mode
yarn test --watch
The first time, you might see this message:
INFO: Running elmi-to-json for the first time; downloading the actual binary
. Simply run the command again.
Install a new package (e.g. elm/svg
):
yarn run elm-install elm/svg
This generator gives you scripts that are aliases to the one provided by Create Elm App (e.g. yarn start
for elm-app start
).
To learn more about the tasks available for your project, directly checkout this guide.
Trying it locally
If you to try this generator on your local machine, feel free to clone this repo and run the following commands:
# install dependencies:
yarn
# make it available for yeoman:
npm link
Examples
If you want to see and try some examples, checkout this dedicated repository: https://github.com/lgdd/liferay-elm-examples.
What is Elm?
As the official site states, Elm is a delightful language for reliable webapps. How? By providing features such as:
- No Runtime Exceptions
- Great Performance
- Enforced Semantic Versioning
- Small Assets
- JavaScript Interop
The best way to learn Elm is to follow the official guide. You can try Elm with this online editor.
You can also checkout this non-exhaustive list of nice talks about Elm:
- Why Elm?
- Elm crash course - Building unbreakable webapps fast
- Developer Happiness on the Front End with Elm
- Building UIs in the Dark
- Scaling Elm Apps
- The life of a file