material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Build] Create a tool to build a standalone version of Material-UI

Open daniellewissc opened this issue 11 years ago • 41 comments

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?

daniellewissc avatar Jan 21 '15 23:01 daniellewissc

I think we'll need to do #173 first.

hai-cea avatar Jan 22 '15 03:01 hai-cea

so we can use compiled js and css files soon?

EricHan0723 avatar Jan 26 '15 09:01 EricHan0723

@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 avatar Feb 17 '15 17:02 hai-cea

:+1:

l4u avatar Jul 19 '15 03:07 l4u

@hai-cea what's left to do for making a CDN version of Material-UI?

currentoor avatar Nov 25 '15 06:11 currentoor

:+1:, could really use a CDN version.

kenbier avatar Nov 25 '15 16:11 kenbier

Hey guys I'm bumping this thread again. Does anyone know what is outstanding to put this lib on a CDN?

currentoor avatar Nov 29 '15 21:11 currentoor

@shaurya947 Was working on it last week.

oliviertassinari avatar Nov 29 '15 21:11 oliviertassinari

This will be my focus over the next couple weeks.. will update you guys as progress happens.

shaurya947 avatar Nov 30 '15 20:11 shaurya947

Awesome!

currentoor avatar Nov 30 '15 21:11 currentoor

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 avatar Dec 01 '15 23:12 justjacksonn

@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 avatar Dec 02 '15 17:12 shaurya947

@shaurya947 that is even better than true CDN IMO!

currentoor avatar Dec 02 '15 19:12 currentoor

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.

justjacksonn avatar Dec 02 '15 23:12 justjacksonn

@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:

  • find out how to push bundle file through for download (might consider zipping if source map is there too)
  • look into handling multiple request at the same time (and necessary code changes)
  • create bare-bones form on material-ui.com so that app can be set up on heroku and be field-tested

After that:

  • iterate and improve
  • options for minifying, uglifying, and including / excluding source maps
  • look into making previous versions of MUI available (at least those that depended on React v0.13.x)
  • caching for source files and build files

shaurya947 avatar Dec 03 '15 22:12 shaurya947

@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 avatar Dec 09 '15 07:12 currentoor

@currentoor this was one of the first design decisions @hai-cea and I made.

The thing is that we're doing an npm i to get the source files for Material-UI (which installs React too since it's a peer-dependency), and then leveraging webpack to resolve all dependencies and build the output -- which would fail without React.

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 React and ReactDOM accordingly. After that, we'll work on getting at least the last few React v13-compatible MUI versions up and running. Moreover, the fact that we include the React that's supposed to work is one less headache for the developer, no?

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 :-)

shaurya947 avatar Dec 09 '15 17:12 shaurya947

which would fail without React.

We could tell wepback that react is an external dependency.

I'm not going to use this cdn version, but I think that I would be better to have react outside. Material ui releases are more frequent than react. This would be better for cache invalidation. Still, I'm wondering if the react-tap-event plugin will let us do it.

oliviertassinari avatar Dec 09 '15 18:12 oliviertassinari

We could tell wepback that react is an external dependency.

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

shaurya947 avatar Dec 09 '15 20:12 shaurya947

@shaurya947 @oliviertassinari

Still, I'm wondering if the react-tap-event plugin will let us do it.

Have you seen this issue? Perhaps it will help.

kenbier avatar Dec 09 '15 21:12 kenbier