Xterm.js: react import xterm don't load css file ?

Created on 26 Apr 2018  路  3Comments  路  Source: xtermjs/xterm.js

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.

typquestion

Most helpful comment

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.

All 3 comments

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.

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

for scss:

@import '~xterm/dist/xterm.css';
Was this page helpful?
0 / 5 - 0 ratings

Related issues

travisobregon picture travisobregon  路  3Comments

jerch picture jerch  路  3Comments

johnpoth picture johnpoth  路  3Comments

parisk picture parisk  路  3Comments

jestapinski picture jestapinski  路  3Comments