Skip to content

LeDDGroup/js-to-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-to-file

npm version Conventional Commits code style: prettier

Evaluate js and output result to file

Install

$ npm install --save-dev js-to-file

Usage

$ js2file templates/ --outDir dist --ext html

Options

$ js2file --help

Usage
  $ js2file [folder]

Options
  --outDir where to output files to, defaults to [folder]
  --ext    resulting extension, required
  --require require file before execution

Examples
  $ js2file templates/ --outDir dist --ext html
  typescript
  $ js2file templates/ --outDir dist --ext html --require ts-node/register
  ttypescript
  $ TS_NODE_COMPILER=ttsc js2file templates/ --outDir dist --ext html --require ts-node/register

Example

// templates/home.js
exports.default = () => "<h1>Hello World</h1>";
// dist/home.html
<h1>Hello World</h1>