如何在不安装material-ui的情况下安装Material-UI Docs? [英] How to install Material-UI Docs WITHOUT installing material-ui?

查看:107
本文介绍了如何在不安装material-ui的情况下安装Material-UI Docs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前要在本地安装和运行material-ui文档,它需要两个npm install,一个在material-ui中,另一个在material-ui/docs中.

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

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

但是我想以docs网站为起点来创建自己的应用.如何在不安装整个material-ui的情况下安装文档?我尝试将"material-ui": "^0.14.4",material-ui/package.json中的所有依赖项添加到material-ui/docs/package.json.

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.

这样,npm install没有任何抱怨,但是当我执行npm run startnpm run browser:development时,它不起作用.相反,它会吐出一堆错误消息(部分内容请参见下文).

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" .....

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" .....

请指教!谢谢.

推荐答案

在此仓库中,我从父MUI处嘲笑了MUI-Docs网站:

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

除了消除对父Material-ui的依赖之外,它还具有以下优点:

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

  • DRY和左导航菜单的n级水平.要添加/修改原始MUI文档的左侧导航,您必须修改否 少于三个不同的源文件.该模板将根据app-routes.js自动调整左侧导航 包括n级深.

  • 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.

项目中的自定义主题. MUI被设计为易于使用,并带有两个不错的主题,但事实并非如此 显而易见,如何在上下文中为所有组件激活自定义主题.现在,主题"页面具有三个 主题,并且默认为自定义主题,因此,如果删除主题"页面,它将以您的主题开始,而不是 而不是其中之一.只需修改customBaseTheme.js.我还修改了许多组件和页面以使用主题.内联设置在很多地方都不符合主题颜色和间距.

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和react-highcharts的图表页面示例.

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.

请注意,该回购有两页专门针对Pendo(我正在与之合作的公司).除非您拥有Pendo的权限,否则它们将无法正确呈现,但是您可以通过删除该名称的文件夹并将其路由从app-routes.js中删除来轻松删除这两个页面.我计划清理这些内容,并将Pendo特定的内容移到其自己的存储库中,但是在这里将其作为示例会更容易.

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.

这篇关于如何在不安装material-ui的情况下安装Material-UI Docs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆