mason 0.0.1-dev.7 mason: ^0.0.1-dev.7 copied to clipboard
A Dart template generator which helps teams generate files quickly and consistently.
⛏️ mason #
A Dart template generator which helps teams generate files quickly and consistently.
pub global activate mason
Creating Custom Templates #
Define Template YAML #
greetings.yaml
name: greetings
description: A Simple Greetings Template
vars:
- name
Define Template #
Write your template in __template__
using mustache templates. See the mustache manual for detailed usage information.
__template__/greetings.md
# Greetings {{name}}!
Consuming Templates #
Create a Mason YAML #
Define a mason.yaml
at the root directory of your project.
templates:
greetings:
path: ./greetings.yaml
widget:
git:
url: git@github.com:felangel/mason.git
path: templates/widget/template.yaml
Then you can use mason build <greetings|widget>
:
mason build greetings -- --name Felix
mason build widget -- --name my_widget
Command Line Variables #
Any variables can be passed as command line args.
$ mason build greetings -- --name Felix
Variable Prompts #
Any variables which aren't specified as command line args will be prompted.
$ mason build greetings
name: Felix
The above command should generate GREETINGS.md
in the current directory with the following content:
# Greetings Felix!
Usage #
$ mason --help
⛏️ mason • lay the foundation!
Usage: mason <command> [arguments]
Global options:
-h, --help Print this usage information.
--version Print the current version.
Available commands:
build Generate code using an existing template.