mason 0.0.1-dev.6 mason: ^0.0.1-dev.6 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.
Activate Mason #
pub global activate mason
Define Template YAML #
greetings.yaml
name: greetings
description: A Simple Greetings Template
files:
- from: greetings.md # template file (input)
to: GREETINGS.md # generated file (output)
vars:
- name
Define Template File(s) #
Write your template using mustache templates. See the mustache manual for detailed usage information.
greetings.md
# Greetings {{name}}!
Build #
Command Line Variables #
Any variables can be passed as command line args.
$ mason build -t greetings.yaml -- --name Felix
Variable Prompts #
Any variables which aren't specified as command line args will be prompted.
$ mason build -t greetings.yaml
name: Felix
The above command should generate GREETINGS.md
file with the following content:
# Greetings Felix!
Using Mason YAML #
Optionally define a mason.yaml
at the root directory of your project.
templates:
greetings:
path: ./greetings.yaml
widget:
path: https://raw.githubusercontent.com/felangel/mason/master/example/templates/widget/widget.yaml
Then you can use mason build <greetings|widget>
:
mason build greetings -- --name Felix
mason build widget -- --name my_widget
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.