Replies: 1 comment 1 reply
-
You import it the same as jQuery Terminal import $ from 'jquery';
import Terminal from "jquery.terminal";
import XMLFormatter from "jquery.terminal/js/xml_formatting.js";
import "jquery.terminal/css/jquery.terminal.css";
Terminal(window, $);
XMLFormatter(window, $);
$('body').terminal({
echo(...args) {
this.echo(`<white>${args.join(' ')}</white>`);
}
}, {
checkArity: false
}); And jQuery is optional because Terminal import it if it's not defined, so you can use code like this: import Terminal from "jquery.terminal";
import XMLFormatter from "jquery.terminal/js/xml_formatting.js";
import "jquery.terminal/css/jquery.terminal.css";
const $ = Terminal(window);
XMLFormatter(window, $); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I would like to ask if any of you know how to import
"jquery.terminal/js/xml_formatting.js"
using npm modules.This is how I'm currently using
jquery.terminal
and it's working well - but withoutxml_formatting
.References where I sourced the solution from:
I'm using only vanilla JS, NPM and Vite.
How to reproduce
1. Create a new JS project using Vite and just accept the defaults
This will create a very basic JS project.
2. Install jquery and jquery.terminal using NPM
3. Cleanup the project for our test
main.js
index.html
and delete all the other files, but this won't have any impact.You should have this
index.html
I prepared a simple terminal with just a prompt for our test
This should produce a terminal like this
Testing XML
Now if I swap the
prompt()
function withpromptXml()
- this is how the terminal is renderedWhen working in CDN mode, everything works, including the xml, but I really need this to work with the installed modules and ideally with import statements.
I hope I was able to provide all the context from my question and I will appreciate it a lot if you can help me solve this one. Thank you! I really like this library. :)
Beta Was this translation helpful? Give feedback.
All reactions