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

Some thoughts, questions and ideas ;) #1

Open
kristianmandrup opened this issue Oct 2, 2014 · 7 comments
Open

Some thoughts, questions and ideas ;) #1

kristianmandrup opened this issue Oct 2, 2014 · 7 comments

Comments

@kristianmandrup
Copy link

Hi there,

I found your project very interesting. I'm discussing how to integrate jspm into ember-cli with @stefanpenner and @guybedford ;)

We definitely need a new Ember Resolver optimized for jspm and a new project config :)
How do you launch your app? Normally the package.json contains the following which uses ember-cli.
Of course you could always setup a minimal express server or similar? Just curious ;)
I forked your repo and will do some of my own experiments... did you take a look at @guybedford's fork of ember-cli with initial jspm integration?
Cheers!

  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },

Would be nice with sth like the following

var express = require('express');
var app = express();

app.use('/', express.static(__dirname));

app.get('/', function (req, res) {
  res.render('index');
});

var server = app.listen(8888, function() {
    console.log('Listening on port %d', server.address().port);
});

then I think you need to jspm bundle and --inject ? Could you please build/launch instructions in the readme. Thanks :)

@stefanpenner
Copy link

@kristianmandrup I don't think we need a new resolver, it merely needs to peak into a different module registry

@kristianmandrup
Copy link
Author

@stefanpenner I got the app up and running on minimal express server setup.

https://github.com/kristianmandrup/emberjs-experiment

Here is the resolver which extends Ember.DefaultResolver. I think it looks pretty neat and simple...

https://github.com/kristianmandrup/emberjs-experiment/blob/master/app/resolver.js

@kristianmandrup
Copy link
Author

I just started the following experimental generator project:

https://github.com/kristianmandrup/generator-ember-jspm

@jmzhang
Copy link
Owner

jmzhang commented Oct 2, 2014

Indeed, the little resolver I put together simply looks up modules in the systemjs registry. It's only a proof of concept thing.

To answer your question, for this experiment, I load the ember app directly in my browser. But normally, I use play framework for the server side. Unfortunately, I'm still looking for a way to use the native asset pipeline in play framework to compile ember app with es6 flavor and Ember does not seem to be very cooperative in this matter.

To digress a bit, actually, I think it might be a good idea to use SystemJS as the default module loader for Ember as this could open up tons of possibilities - we can use features from systemjs and jspm to transpile es6 modules and bundle the ember app from nearly any framework in any language that has js runtime libs, provided that jspm also offers some api to do that.

EmberCLI seems to be an awesome one-stop solution for front end developers to get things done quickly. But people are using different server frameworks with different asset pipelines, EmberCLI cannot replace them all, so an adaptive solution is really needed and I think systemjs is the key to this.

I'm not sure if I'm on the right track, but what you guys think @stefanpenner @guybedford ?

@kristianmandrup
Copy link
Author

I believe that jspm and SystemJS are the best package managers for now until we get native ES6 module support. Makes sense to go all in with ES6 modules and not be limited to whatever package format libraries are built in. Makes sense to build everything using ES6 module syntax going forward and have it as the recommended standard for Ember in my mind.

@kristianmandrup
Copy link
Author

On another note, I couldn't figure out how your application figures out to load and use css.js and hbs.js both present in the project root. I couldn't find any reference? I tried moving them to into package.json to become normal jspm dependencies (System plugins...?)

@guybedford
Copy link

This is probably why these files are at the server root level, because a normal System.import('css') should fetch them directly from that location.

If not, you may need to change the baseURL (System.baseURL / System.config({ baseURL: ... })). Note you can also set up files like this using custom map or paths config in the config.js file.

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

No branches or pull requests

4 participants