Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it work on browser? #3

Closed
amatiasq opened this issue Feb 17, 2014 · 5 comments
Closed

Does it work on browser? #3

amatiasq opened this issue Feb 17, 2014 · 5 comments

Comments

@amatiasq
Copy link

Is there a browser version?

@rburns
Copy link
Owner

rburns commented Feb 17, 2014

I was using it to pipe terminal output to the browser via a websocket. Is there another browser interaction you were thinking of? The code might run in the browser if you use broswerify, though I've not tried that.

@amatiasq
Copy link
Author

As my clients apps are not only web I prefer my server to send ASCII colors and each client interpret it depending on the rendering engine (html or not).

@rburns
Copy link
Owner

rburns commented Feb 17, 2014

there's no dependencies. so, browserify may work out for that, I'd be interested to know if you get it working in that manner.

@amatiasq
Copy link
Author

Thanks for the info and the quick response, I'll try browserify and post the result here.

@amatiasq
Copy link
Author

Cool! It was easier than expected:

$ npm install browserify ansi-to-html
$ node_modules/.bin/browserify --require "ansi-to-html" > ansi-to-html.browser.js

And on the HTML

<script src="ansi-to-html.browser.js"></script>
<script>
  var Convert = require('ansi-to-html');
  var convert = new Convert()
  document.body.innerHTML = convert.toHtml('\x1b[30mblack\x1b[37mwhite');
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants