Last active
February 8, 2018 05:47
-
-
Save jasonmelgoza/81a20780dd1be82caac36abacf5733fd to your computer and use it in GitHub Desktop.
Lodash readme doc script for Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash') | |
var fs = require('fs') | |
var module = require('./package.json') | |
// Read external file | |
var srcCSS = fs.readFileSync('./'+module.name+'.css', 'utf8') | |
// Read template | |
var template = fs.readFileSync('./templates/README.md', 'utf8') | |
// Create lodash template function | |
var tpl = _.template(template) | |
// Render template function to an HTML string | |
var md = tpl({ | |
module: module, | |
srcCSS: srcCSS | |
}) | |
// Write file | |
fs.writeFileSync('./README.md', md) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment