Is there some way to use Meteor strictly 100% client-side, a la plain old HTML/Javascript? I imagine a process where I build front-end code and pretty much everything is in client/
, and then I can minify/build/compile into HTML & Javascript, which I can upload to a web server and have it work. No Node needed, no Mongo, etc. Is this doable? If not, what’s the closest I can get?
probably impossible, in my opinion.
Meteor relies on serving your code to the client using Node.js
why would you want to use Meteor for that purpose anyway?
Yeah this is totally possible. Meteor is nothing but a series of packages that work together. All you have to do is remove all of them and then add blaze (the client library for meteor). If you are interested in learning more you can read about it here.
You could host your app on a static server, eg S3 or GitHub gh-pages, but still get the benefit of Meteor’s build tools
there are plenty of tools adequate for that task without Meteor, sounds to me like hammer thumps on something that’s not a nail…
Actually it’s pretty convenient to just meteor add
stuff you need, develop straightforward with blaze (or whatever you like), and ignore the server/data part for a while.
For me it’s way simpler than setting up grunt/gulp/brunch… or tweaking a skeletton to your needs and so on.
If there would be a meteor add-platform client-only
or something like that, this would be awesome! It should just return a single html/js/css file, or even everything inlined ideally. Shouldn’t be too hard to accomplish and really kicks ass for fast frontend-only development I’d say.
I think it’s pretty obvious why someone would want to use Meteor as client-only. It’s got a powerful templating system that blows Handlebars away, not to mention Blaze, being able to use client-side reactive collections, and much more.
That being said, here’s the solution: https://github.com/frozeman/meteor-build-client
alright, I take my words and bias back.
Hope it works out for you
As a front-end developer I use this approach all the time. It makes prototyping apps for clients SUPER fast and easy, even if you just need to deliver static HTML/CSS/Javascript files without a back end. I’ve even written a bash script that converts page template files into static HTML, thanks all to Blaze!
yes, @chenroth is correct. Just rip out the pub/sub code. I hear people are even making Chrome extensions in Meteor
There’s more to it than that. Even without pub/sub, Meteor is still a server itself running on Node.js. You have to make your own index.html file and put some special scripting and css classes in the <head>
, and of course link to the proper css and js files. You should/must also make a call to Meteor.disconnect()
up front.
But again, this does all that automagically for you: https://github.com/frozeman/meteor-build-client
PS: It works great, and I even tested client-side collections. I’m able to use Meteor to build pure client-side apps that can run on nginx, Apache, etc.
Yes, I am (building Chrome extensions using Meteor) Though at the moment I’m cheating a bit by pulling in the Meteor app via iframe tag since I hadn’t yet figured out how to make Meteor produce something client-only.
Though it’s also handy to be able to use the server-side part for a Chrome/browser extension just like you’d usually do… But meteor-build-client
looks great, very useful!
you look at these?
can-i-use-meteor-in-a-google-chrome-web-extension-content-script
This is Boilerplate for a Meteor.js Chrome Extension
Make sure you think about any and all implications of being 100% client-side only. Without server-side rendering via the spiderable
package, your site will be unreadable by search engines and you will not have any SEO. But if this isn’t a concern, or not applicable in the case of Chrome extensions, it seems to be smart to only take the parts that you need.
There might be performance implications to consider in any case. When developing locally with --production
enabled, I found that it took ~150ms to download the minified CSS+JS and another ~300ms for the templating engine to compute.
I’m using meteor-build-client as mentioned above. It’s fantastic!
I copy the exported css/js/assets into my express api project and setup a route to the generated launcher html. Serve this up in a webview in my native ios client and I’ve just replaced a large chunk of my native app with meteor.
Works like a charm.