highlighted-sources

Browserify transform to cache the contents of certain js files on bundling. The source files are highlighted to HTML with prism.js before caching them as strings in a js object indexed by file name.

Usage no npm install needed!

<script type="module">
  import highlightedSources from 'https://cdn.skypack.dev/highlighted-sources';
</script>

README

highlighted-sources

This transform implements a way to cache the contents of certain *.js files on bundling, filtering file names by comparing them with a given list of keywords through a Regexp. The source files are highlighted from strings to HTML with prism.js, before caching them as strings in a js object (indexed by keyword : {name : fileName, content, contentAsString}).