Skip to content
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

Meteor build client-only #6

Open
raix opened this issue Nov 20, 2014 · 34 comments
Open

Meteor build client-only #6

raix opened this issue Nov 20, 2014 · 34 comments

Comments

@raix
Copy link
Contributor

raix commented Nov 20, 2014

Fabian Vogelsteller (@frozeman):
I was requesting this feature a while back, but with the new platform system of Meteor it is very possible now.

I would like to have a client-only platform, where it creates a bundle with only the client side files and an "index.html" as start file.
This would allow to host the client side part of a meteor app on any static server, as well as use it in a native app bundler like tideSDK, or Sentenza Desktop.

I would like to see the following command possible:

 $ meteor add platform client-only

Which then produces a bundles tar ball containing only the index.html, bundle.js and bundle.css.

This would make meteor also immediately available for people who want to use it as fronted library instead of angularjs (growing user base ;)

Zoltan Olah (@zol):
The outstanding issue is that by default the DDP package assumes there is a server to connect back to. Would MDG be open to changing this behavior - perhaps passing something in via meteor_runtime_config that disables the autoconnect?

Ref:
https://github.com/SpaceCapsule/packmeteor/issues/32
https://groups.google.com/forum/#!topic/meteor-core/Pa2Zi0rA7Sg

@raix
Copy link
Contributor Author

raix commented Nov 20, 2014

@zol maybe the connection could be optional - eg. if bundling for cdn's we might still want the connection but not the hot code push.

# No connection - client-only
$ meteor add platform client-only

# For CDN deployment
$ meteor add platform client-only -h "http://my.app.com"

# Or
$ meteor build client-only

@IstoraMandiri
Copy link

👍

@PEM--
Copy link

PEM-- commented Nov 21, 2014

👍 With the appearance of DDP on other server stacks, devs using already made server (Wordpress, Prestashop, ...) could switch gradually to Meteor with confidence. Actually, porting DDP to the major other server stack could also really help breakthrough in adoption.

@grigio
Copy link

grigio commented Nov 21, 2014

👍 I suggest to specify just the hostname.domain and select "http/ws" or "https/wss" automatically

@Slava
Copy link

Slava commented Nov 24, 2014

@raix
Copy link
Contributor Author

raix commented Nov 24, 2014

Thanks @Slava its linked under "references" in the top description

@gadicc
Copy link

gadicc commented Nov 25, 2014

Been a while since I added anything to Meteorpedia... added those initial instructions plus a ref to the intended pattern and this thread at http://www.meteorpedia.com/read/Building_for_the_client_only

@raix
Copy link
Contributor Author

raix commented Nov 25, 2014

Just a note - would something like $ meteor build client-only <output path> (with --server / --directory / --debug as options) be sufficient?

--server will determine if ddp should be present eg. for cdn?

@gadicc
Copy link

gadicc commented Nov 25, 2014

I quite like that. Short and sweet. Although I admit I've never had the need for this before, so could be missing something. I'd also suggest --ddp= which is maybe a little clearer on what server we're referring to.

@frozeman
Copy link

Hi,
thanks @raix for continuing the discussion. I personally think now that the client-only might be to general and we should better have something like meteor build browser or browser-only.

Currently if you look into the .meteor/platforms file you will find server and browser already exist.
though the browser-only or even server-only should be available and build a proper index.html.

separating the two this way would help to host meteor on other server infrastructures, or of example to use the meteor ddp connection only for specific actions (even by multiple and native apps)

I think this, with the right showcases and tutorials would do a great deal for meteor adoption!

@tonyaom
Copy link

tonyaom commented Nov 29, 2014

+1 billion if possible

@ctzurcanu
Copy link

+1

1 similar comment
@loredanacirstea
Copy link

+1

@mitar
Copy link

mitar commented Dec 18, 2014

I would love that as well. I opened a discussion about this on the mailing list some time ago. I think this would be great with combination of WebRTC for DDP protocol so one could use it to talk between browsers directly. A simple list of peers served together with static index.html could make the trick. (That list of peers could be maintained with any other server-side software, much simpler than Meteor or node.js itself.)

@mitar
Copy link

mitar commented Dec 18, 2014

Related: meteor/meteor#1223

@merunga
Copy link

merunga commented Dec 20, 2014

I found this Standalone Blaze Generator, and tweaked it to bundle minimongo, blaze and session packages in a single js file for the browser, with no sockjs connection error or the need for Meteor.disconnect().

Haven't tested it at all beyond this example on gh-pages.

Is this useful for anyone? Make any sense?

@frozeman
Copy link

frozeman commented Jan 7, 2015

Looks very good, thanks. Any ideas how to precompile all the templates? Personally i love the meteor command line tool, so i don't have to link, minify, concatenate and require.js all the files ... again.

I just found ractive.js, which looks very similar to Spacebars, though i love the reactive helpers and Tracker better.

@sferoze
Copy link

sferoze commented Apr 10, 2015

Hi,

I am making a Cordova app using Meteor to communicate with a bluetooth device. We do not need a server, or any internet connection.

I currently plan on just using Meteor.disconnect

but that means I would still be shipping connection code even though i am not using it.

I want to take this out.

How can I do this before submitting to the app store?

Thanks in advance!

@zimme
Copy link
Member

zimme commented Apr 10, 2015

I think one approach is to see which packages the meteor-platorm package depends on.

Then instead of using meteor-platform you use all the separate packages instead, removing the one handling connections.

But this might not work because a lot of packages actually depend in connection logic as you can
manually specify a connection per collection and such.

I'm talking about core packages.

@mitar
Copy link

mitar commented Apr 10, 2015

A bit tangential, but I made this package once when I needed to compile custom Meteor package and then inject the resulted JS into the client only: https://github.com/peerlibrary/meteor-package-builder

Maybe you could use to build the client JS and then use only that.

@Maxim-Filimonov
Copy link

My 5 cents...
Not sure why MDG is so resistant to make this happen. I understand that current focus is new fancy companies who can write greenfield projects BUT meteor is gonna push itself into the same trap which angular fall into. You either write an angular app THE angular way or you hack around by passing json into ng-init. Which made angular VERY hard sell for any existing interfaces.

Our use case for client side only build:
We have couple of areas in our existing UI which we want to use meteor for, we don't have luxury to just throw away all existing code and rewrite everything in meteor. We have meteor server running connected to a mongo database, so we thought why not to use meteor for those UI pieces where we want to have reactivity and slowly adapt meteor in all other parts going forward.

@mitar
Copy link

mitar commented Apr 23, 2015

Some of this would be interesting to integrate with Meteor:

@frozeman
Copy link

I finally did it myself :)
https://github.com/frozeman/meteor-build-client

@sferoze
Copy link

sferoze commented Apr 30, 2015

@frozeman Can this work to build a cordova mobile app that is for the client only? It looks like it is only for web currently.

@Maxim-Filimonov
Copy link

@frozeman Awesome work! 👍

@frozeman
Copy link

frozeman commented May 1, 2015

@sferoze isn't the meteor native cordova deploy not enough?
i'm currently not planning in adding any cordova feature, as i wanted only to get the minimalistic files to run in everywhere (or even by just opening the index.html)

@sferoze
Copy link

sferoze commented May 3, 2015

@frozeman Well when you build your app for Cordova you are expected to input a mobile server address. This is because the DDP package is still part of the mobile app. Currently I have in the client code Meteor.disconnect() so the app does not use the DDP package. But this is still not optimal.

@frozeman
Copy link

frozeman commented May 3, 2015

The client side part generated with meteor-build-client also uses Meteor.disconnect() to prevent any server connection (which would lead to an endless reload cycle).

Its not ideal, but it works.

@rurri
Copy link

rurri commented May 6, 2015

This is a great idea.

+1

@sdomagala
Copy link

Any idea if you can make some kind of routing for client-side only?

@frozeman
Copy link

Use iron-router or flow-router.

@sdomagala
Copy link

Obviously, I forgot to say I don't wanna use meteor for it, just blaze for static content

@frozeman
Copy link

Look at my tool: https://www.npmjs.com/package/meteor-build-client

This lets you develop you app with meteor, and get on the end static files with index.html ;)

@vyky
Copy link

vyky commented Sep 2, 2016

Hi @sferoze what you put on --server flag when you build meteor cordova client only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests