Search code examples
webmaterial-components

MDC-web Howto build individual css files pr component


For the MDC-Web project webpack bundles all components into a node_modules/material-components-web/dist/material-components-web.css For debug, understanding and integration, I try to build individual components, e.g. mdc-drawer.css

The documentation at section css indicates this is possible, but not how https://github.com/material-components/material-components-web. So one could obtain e.g. dist/mdc-drawer.css and dist/mdc-drawer.min.css

I guess this should be done in the config of the webpack build https://github.com/material-components/material-components-web/blob/master/webpack.config.js

Anyone have tips on this?


Solution

  • In the root of the material-components-web project, run the command

    npm run build

    This generates css/js files pr. component, in dir build

    Serve for my purpose. Have very limited experience with webpack/mdc-web, so if better ways exits don't hesitate to add them.