Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Material-UI Docs WITHOUT installing material-ui?

currently to install and run material-ui docs locally, it requires two npm install, one within material-ui, another within material-ui/docs.

cd <project folder>/material-ui npm install cd <project folder>/material-ui/docs npm install

But I want to use the docs site as a starting point to create my own app. How can I install the docs without installing the whole material-ui? I've tried adding "material-ui": "^0.14.4",, and ALL dependencies in material-ui/package.json to the material-ui/docs/package.json.

With that, npm install doesn't complain anything, but when I do npm run start or npm run browser:development, it doesn't work. Instead, it spits out whole bunch of error message (see below for part of it).

ERROR in ../src/table/table-header-column.jsx Module build failed: ReferenceError: Unknown plugin "transform-replace-object-assign" specified in "/home/ubuntu/repos/tutorials/mui/.babelrc" at 0, attempted to resolve relative to "/home/ubuntu/repos/tutorials/mui" .....

Please advise! Thanks.

like image 583
realbug Avatar asked Feb 27 '16 09:02

realbug


People also ask

Is material UI necessary?

Material UI provides developers with material-based UI components. They help save some time on design and app development. But since Material UI is mostly a set of UI components, it doesn't offer such a great boost to the development speed as Bootstrap does.

Can I use material UI for free?

MUI X is a collection of advanced UI components for complex use cases. Most of MUI X's components are available for free, but more advanced features require a Pro or Premium commercial license. MUI Core focuses on empowering the creation of great design systems with React.

Is material and material UI the same?

Material Design: Google's Material Design. Material Design is a unified system that combines theory, resources, and tools for crafting digital experiences; Material-UI: React components for faster and easier web development.


1 Answers

I have teased the MUI-Docs site from parent MUI here in this repo: https://github.com/lmaccherone/material-ui-template.

In addition to removing the dependency upon parent material-ui, it has these advantages:

  • DRY and n-levels of left nav menu. To add/modify the left nav of the original MUI docs, you had to modify no less than three different source files. This template will automatically adjust the left-nav based upon app-routes.js including n-levels deep.

  • Custom theme in the project. MUI is designed to be themable and comes with two nice themes, but it's not immediately obvious how to activate a custom theme in context for all components. The Themes page now has three themes and it defaults to the custom one, so if you remove the Themes page, it will start up with your theme rather than one of the prebuilt ones. Just modify customBaseTheme.js. I also modified many components and pages to use the theme. There were many places where inline settings didn't honor theme colors and spacing.

  • Highcharts. There is an example chart page that uses Highcharts and react-highcharts.

  • Advanced Table. It includes a component that renders a table where you can click on the columns to accomplish sorting.

Note, that repo has two pages specific to Pendo (a company I'm working with). They won't render correctly unless you have permissions for Pendo, but you can easily remove those two page by removing the folder by that name and removing it's routes from app-routes.js. I plan to clean that up and move Pendo specific stuff into it's own repo, but it was just easier to have it here as examples.

like image 142
Larry Maccherone Avatar answered Sep 27 '22 16:09

Larry Maccherone