node-file-to-string

jade helper that outputs whatever textbased file as a string

Usage no npm install needed!

<script type="module">
  import nodeFileToString from 'https://cdn.skypack.dev/node-file-to-string';
</script>

README

node-file-to-string

node helper that outputs whatever file (html, xml, svg etc..) as a string. Using a cache, and automatic transformers by file-type

Installation

npm install node-file-to-string --save

Usage

Usage in Node / Gulp / Grunt

jadeInline = require('node-file-to-string')();

Make use of transformers

marked = require('marked');
jadeInline = require('node-file-to-string')({
    md: marked
});
/* files ending with *.md will be parsed with marked before returned */

make sure to pass the function to your jade data.

jade.compile('string of jade', { globals: { helpers: {inline: jadeInline} }});

Inside a jade file

!= helpers.inline('somefile.svg')