import package external style css to polymer 3 application

29 views Asked by At

I am using selecttreejs npm module and I am trying to import its css style in my polymer3 application, it seems like its not loading completly. It looks like this, overlapping with background text. How can I import the external css to polymer 3 app. enter image description here

import { Treeselect } from 'treeselectjs';
import treeselect from "treeselectjs/dist/treeselect-js.css";
let myCSSLiteral = htmlLiteral(treeselect); 
class WorkspaceSelector
extends PolymerElement {
  static get template() {
    return html `
        <style>
          ${myCSSLiteral}
          
            #workspace-select {
                width: 100%;
            }
            .sciome-select {
                font: 400 16px "acumin-variable-concept";
                padding: 5px;
            }
            
        </style>
1

There are 1 answers

0
Metal Paw On

You should just be able to use the standard link tag in your html code.

return html`
    <style>
      #workspace-select {
        width: 100%;
      }
      .sciome-select {
        font: 400 16px "acumin-variable-concept";
        padding: 5px;
      }
    </style>

    <link href="treeselectjs/dist/treeselect-js.css" rel="stylesheet" />;
`;