mason 0.0.1-dev.8 copy "mason: ^0.0.1-dev.8" to clipboard
mason: ^0.0.1-dev.8 copied to clipboard

outdated

A Dart template generator which helps teams generate files quickly and consistently.

⛏️ mason #

pub 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

JSON Input Variables #

Any variables can be passed via json file:

$ mason build greetings --json greetings.json

where greetings.json is:

{
  "name": "Felix"
}

The above commands should all 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.
762
likes
0
pub points
97%
popularity

Publisher

verified publisherbrickhub.dev

A Dart template generator which helps teams generate files quickly and consistently.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, checked_yaml, io, json_annotation, mustache_template, path, recase, yaml

More

Packages that depend on mason