-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Build] Create a tool to build a standalone version of Material-UI #262
Comments
I think we'll need to do #173 first. |
so we can use compiled js and css files soon? |
@EricHan0723 in v0.7.0 we're compiling all jsx to js and soon all of the css will be going into the js files. See #30 |
👍 |
@hai-cea what's left to do for making a CDN version of Material-UI? |
👍, could really use a CDN version. |
Hey guys I'm bumping this thread again. Does anyone know what is outstanding to put this lib on a CDN? |
@shaurya947 Was working on it last week. |
This will be my focus over the next couple weeks.. will update you guys as progress happens. |
Awesome! |
Currently I deploy my app in a WAR file for a JEE container. To do this, I use WebPack and build the bundle.js file. My index.html page pulls that down. I bundle the index.html page as my welcome page in the web.xml and so far it seems to work. At least for building it all in a WAR file and deploying it to Tomcat or Jetty. |
@justjacksonn we're taking a (slightly) similar approach. material-ui.com will have a new form page for a custom build where you can select the version of MUI you want, the components you want (or all of them), and whether or not you want to minify the output. A heroku app in the backend will use webpack to generate the custom build for you and let you download it. Then you could just include that custom build file in your html page and start using MUI components. Note that this won't really be a true CDN. The form on material-ui.com will send a query string to the heroku app to indicate the version and components for the custom build. Although this URL with the query string can be straight up included in your html page, we do not recommend doing so. It will potentially be slow because a dynamic build needs to happen at the back. We are thinking of ways to cache and optimize, but we have to consider certain space / time trade-offs. |
@shaurya947 that is even better than true CDN IMO! |
Agreed with currentoor.. would rather have all the components in my page available offline than rely on CDN. I think CDN makes sense in a few cases, but what you describe for this sounds better. Ofcourse I use the react import feature to import the components so I dont need this my self. |
@currentoor @justjacksonn @oliviertassinari @TheSeldonPlan @daniellewissc @hai-cea @EricHan0723 @l4u the project is here if you guys would like to follow along. It is at the stage where webpack-uglified builds (with source map) can be produced locally for all MUI versions that depend on React 0.14.x. To do:
After that:
|
@shaurya947 any chance you could avoid including React itself in the output? Between all the different React libs (dom, addons, minified) it is a lot easier to manage React dependencies explicitly. |
@currentoor this was one of the first design decisions @hai-cea and I made. The thing is that we're doing an Personally, I feel it shouldn't be an issue. Right now, my focus is to get the newer MUI versions (that depend on React >= 0.14.0) up and running -- so we're using How I see it, to be able to exclude React from the build, we would have to build without webpack, which entails doing all module-dependency management ourselves -- lots of work. With all this being said, I'm open to any suggestions that you may have :-) |
We could tell wepback that I'm not going to use this cdn version, but I think that I would be better to have react outside. |
Oh, I never thought about that. For now, I will focus on a working deliverable and explore this option once I am at a good point.. |
Have you seen this issue? Perhaps it will help. |
+1 I am new to React (my last experience with web-development was with jQuery, 3-4 years ago). I wanted to use material-ui and I have been stuck with first having to learn how npm/browserify/gulp/watchify etc. works before I can actually code anything. I am sure that these tools are great and produce very efficient production code. However, to start off, a simple JS/CSS file that can be included in my source along with the JS files for React, Babel etc. would drastically reduce the time required to get this working. Thanks. |
@mbrookes @oliviertassinari : Does it still needs to be addressed completely? |
@tintin1343 Yes, it could be really useful 👍. |
@shaurya947 could you give me some hint on how to include the styles portion? or shal Il modify the mui-custom-builder to let it bundle a muiStyles(for material-ui/styles)? |
@vickailiu Are you using this? I din't realise it existed! Yes for 0.15.0 it would need to be updated to include |
IMHO you should release a compiled version in CDNS. Cdnjs is a very good option in my opinion. You can include a compiled version that includes all components. |
Is this tool dead? It would be extremely useful. |
Hi again guys, I'm not using anymore Material UI, but today I remembered this thread and I've thought that I can help with this. I've made a build process with webpack to generate a standalone version of MaterialUI. I've made it quickly, and I have to review it before proposing a pull request. If you want to use it or to try it, you can check my fork of material with this feature: To generate CDN version: This will generate the min file under umd/ folder There is also a basic html page to test it in the same folder, named test-page.html. As soon as I have time I'll read the material-ui contributing rules and I'll open a PR to explain what I've done. |
@vasconita This issue hasn't moved for a long time. Thanks for proposing your help here. You may be able to join forces with #4342. |
#5796 was just merged on the npm install
npm run build:min |
@oliviertassinari What's going on with these random unassigns? There was one yesterday. Seems like a github bug! |
How do I import the components from the UMD file?
if I use
(it's the same for every component, not just MuiThemeProvider) |
@oliviertassinari Thanks for the hard work. Is the UMD build on a CDN? Jsdelivr has the wrong version, and cdnjs doesn't list material-ui at all. Material-UI is the biggest non-CDN'd dependency in my project - using a CDN'd version would be a big win for performance for me. |
@bcherny Material-UI is written so that you only need to import the components that you use. If you use a UMD build, then the client would have to download the entire library, consuming excess bandwidth and memory - particularly bad for mobile clients. |
@mbrookes could you provide an example? doing Edit: found a nasty fix on CodePen, use |
@tomasdev We now host a CDN example. We are following the same pattern. I won't call it a "nasty hack". We would have been exporting a |
I'm so sorry, didn't realize there was a cdn version inside the examples folder. Mea culpa. runs away ashamed |
it would be really convenient for projects where a node based build step is inconvienent, like for a website not hosted on node, but i do understand the difficulties when both the logic and style languages are compiled. Any thoughts?
The text was updated successfully, but these errors were encountered: