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

react import xterm don't load css file ? #1418

Closed
zhangjie2012 opened this issue Apr 26, 2018 · 4 comments
Closed

react import xterm don't load css file ? #1418

zhangjie2012 opened this issue Apr 26, 2018 · 4 comments
Labels
type/question A question on how to use the library

Comments

@zhangjie2012
Copy link

Details

  • Browser and browser version:
  • OS version:
  • xterm.js version: 3.3.0

Steps to reproduce

  1. npm install xterm --save
  2. new Terminal() and term.open(document.getElementById('terminal-container'));

image

Looks like not load xterm css file ? I use xterm with react.

@ghost
Copy link

ghost commented Apr 26, 2018

Hi zhangjie2012,

I don't know that much about react but when you require('xterm') or import 'xterm' you only get js unless your using some special loader. Webpack has a special loader to handle style/css but you have to point to xterm's css file using the import statement. Refer to your bundler/loader's documentation for loading css.

To be clear. The css and js files are stored separately and usually need multiple import statements to get them both.

@Tyriar
Copy link
Member

Tyriar commented Apr 26, 2018

Yes you'll need to include the CSS file as well as in the getting started snippet https://github.com/xtermjs/xterm.js#getting-started

@Tyriar Tyriar closed this as completed Apr 26, 2018
@Tyriar Tyriar added the type/question A question on how to use the library label Apr 26, 2018
@monsterooo
Copy link

for scss:

@import '~xterm/dist/xterm.css';

@nahidacm
Copy link

In react you can do:

import 'xterm/css/xterm.css';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question A question on how to use the library
Projects
None yet
Development

No branches or pull requests

4 participants