Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

mikenikles/plop-helper-git-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plop git config helper

A Plop (www.plopjs.com) helper to read git config values.

Installation

npm install --save-dev plop-helper-git-config

or in its short form: npm i -D plop-helper-git-config

Usage

In your plopfile.js, register it as follows:

const gitConfigHelper = require("plop-helper-git-config");

module.exports = plop => {
  plop.setHelper("gitConfig", gitConfigHelper);
  
  // The rest of your plop file content
}

Now, you can use the gitConfig helper in your *.hbs templates. For example, in a package.json.hbs file:

{
  "author": "{{ gitConfig "user.name" }}, {{ gitConfig "user.email" }}",
  "repository": {
    "type": "git",
    "url": "{{ gitConfig 'remote "origin".url' }}"
  }
}

Special Thanks