Last updated a year ago by jovilin .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install yoso 
SYNC missed versions from official npm registry.



This is a command line tool that automatically generates files from custom templates. You only need to set it once before you can reuse it.


$ npm install -g yoso


First use

Write your own template file before using it for the first time. Here is the template engine used is nunjucks, related syntax reference nunjucks official website.You can put multiple template files in a folder with a certain file structure, or you can put a single file. Use the suffix you want for the template file. For Example

├── component.html
├── component.js
├── component.scss
└── ui.js

To load template files from the git repository, you need to set up the git repository information first.

  • Need username, repository name, branch name (default master), token (not required, but github limits requests to 60 requests per hour for unauthenticated requests) for github.
  • Need gitlab address, repo id, branch, token(required) for gitlab. If the repo id is not clear, it can be searched by entering the repo name; if there is any repo has the same name, enter name with namespace.
$ yoso config

Generate files

  1. Load the template locally
$ yoso new [options] <tpl> <path>

For example

$ yoso new vuex src/store/demo 

Optional argments

  -o, --others Add custom fields
  1. Load the template from the github repository

The GUI operation interface can be easily evoked by yoso init. The configuration at this time is to read the setting parameters in yoso config:

You can also specify parameters to customize the operation:

$ yoso init [options] <tpl> [path]

For example

$ yoso init vuex src/store/demo

Optional argments

  -b, --branch <branch> edit branch
  -u, --username <username> edit username
  -r, --repo <repo> edit repo
  -o, --others Add custom fields

You can use the command line option -o or --others to add custom fields, and inserted into the corresponding position in the template. The default fields include:

  name,//From the input path
  author,//From the git config
  email,//From the git config

The input format iskey value, separated by one or more Spaces, and the leading and trailing Spaces are cleared by default. You can override the default field with a custom field of the same name.

Current Tags

  • 1.2.3                                ...           latest (a year ago)

19 Versions

  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.4                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 19
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
Dev Dependencies (35)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |