5

I am trying to use a mdc-component (say mdc-textfield) within a lit element. Looks like I have to import both css and js files into the element.

I'm quite unsure of how to import css into the lit-element.

BTW I use polymer serve without any preprocessors or compiler.

ryanafrish7
  • 3,222
  • 5
  • 20
  • 35
  • You probably should try using the material web components https://github.com/material-components/material-components-web-components , though most are still in a pre-release status – Alan Dávalos Nov 12 '18 at 21:41

1 Answers1

1

I recommend to wait for Material Component Web Components

But answering your question, to use MCD you need to use sass, then you will need a pre-compiler. Once you have compiled to CSS you can import it into your component:

const anyStyle = html`<style src="path/to/compiled/style.css"></style>`;

I recommend to use a watcher to automatically build the sass files while you are running polymer serve

jorgecasar
  • 641
  • 5
  • 8