Code generation recipes for the Amber Web Framework
Amber generators can use a recipe to generate your application, and scaffold your application with controllers, models and views. Using a recipe you can get started with an amber application that extends or modifies the standard built in generator or provides additional features. For example you might want an API application that only renders JSON or use React or AngularJS for views.
To create an amberframework application from a recipe type;
amber new <appname> -r <recipe>
to create a new amber app from the given named recipe in a folder with the given appname.
The given recipe can be either
- a recipe from this repository
- a directory with an application template
- a URL pointing to a recipe folder (which should contain an app template)
Read the Recipes section in the online guides for more information.
Recipes in this repository are divided into themes based on the kind of application and scaffolding generated by the recipe. For example the basic/granite recipe mimics the amber built-in application template using the granite ORM.
To create a new amber app from this recipe at the command line type
amber new newapp -r basic/granite
to create a new amber app from the recipe at basic/granite in the folder newapp.
amber new newapp -r default
Uses a copy of the standard built-in template and is the same as typing
amber new newapp
You can use a local folder as the source template for a new amber application e.g.
mkdir default_recipe
wget https://raw.githubusercontent.com/amberframework/recipes/master/dist/default.zip
unzip -d default_recipe default.zip
amber new newapp -r default_recipe
The result of which is equivalent to
amber new newapp -r default
Read Contributions to see a list of available themes and app recipes. Each theme folder provides additional information in the folder README.
If you notice a problem with a recipe please raise an issue including example of the expected output and actual output or any errors using the application generated by the recipe.
Recipes use the Liquid template language. The file extension should be .liquid but if you prefer shorter 3 letter file extensions you can also use .lqd which is an unknown or unnassigned file extension. To create a new recipe fork https://github.com/amberframework/recipes, clone your fork, create a new sub folder in the appropriate theme folder (or create a new theme if it doesn't already exist), extract an existing recipe, make your modifications. To build a zip file for distribution type
bash scripts/build_zips.sh
Then submit a PR.
Recipes should contain the following templates:
- app
- controller
- model
- scaffold
Don't forget to add an entry to Contributions.md and the theme folder README.md about your recipe.
Many Thanks.