patorjk / figlet.js

A FIG Driver written in JavaScript which aims to fully implement the FIGfont spec.
MIT License
2.59k stars 165 forks source link

Figlet.js does not work with Browserify #27

Closed websemantics closed 7 years ago

websemantics commented 8 years ago

When I include Figlet.js to the front-end using browserify, the whole thing stops working because of the fs module.

I tried to avoid calling methods that use fs mainly by preloading the fonts using preloadFonts method.

However, when using text or textSync methods the loadFontSync method gets triggered in node.js mode which does not check for already loaded fonts as in the case of browser mode

I created a stop-gap package that solves the problem initially, https://github.com/websemantics/figlet-browserify but it would be nice to make necessary changes to the library to make it work in the browser regardless of the package manager,

mikermcneil commented 8 years ago

@websemantics nice, thanks for sharing!