0

I'm using a basic file manager to maintain my webpages files. How to I begin using MDC-Web Vanilla?

In the MDC-Web Github project folder are: README.md, index.js, material-components-web.scss, and package.json.

I would expect to find <link> and <script> elements to add to MDC-Web to my project, similar to how MDL and Bootstrap work. Where do I find those?

Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91
  • From what I see, the project uses ES6 modules, not yet support by all browser e.g. Chrome. webpack build the components into one bundle with the option of translation to support browser with no ES6 modules. – Jonas Bojesen Feb 18 '17 at 18:00

1 Answers1

1

This works. You need to attach/initialize JS on some components/elements.

<link rel="stylesheet" href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:100,300,400,700,900">
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91
  • Your code above threw an error for me. That error is fixed by replacing "MDCTextfield" with "MDCTextField". But after fixing that error, I get another: "material-components-web.min.js:262 Uncaught TypeError: Cannot read property 'hasAttribute' of null". Would you check that your code sample above still runs please? – Martin Omander Mar 18 '18 at 08:10
  • 2
    @MartinOmander Got it. MDC-Web has made a few updates that are not backward compatible (like 'mdc-simple-menu' is now 'mdc-menu'). – Ronnie Royston Mar 18 '18 at 15:41