mardi 29 septembre 2015

Adding Ember CLI in a project that already exists

i want use Ember CLI, but i already have my own structure, i have all my backend ready for receive the client, and i can't change now, i'm working for months in this project.

I'm not finding a easy way to add the Ember CLI in my project, and i'm not finding any tutorial to help me achieve my needs.

My structure is like this:

| - bin
| - core
  | - client
    | - app
      | - site
        | - app.js                      // HERE I'M TRYING TO START THE EMBER
    | - public // Static files
    | - views
      | - site.layout.html
  | - server
    | - // All server files, not really matters here.
| - ember-cli-build.js
| - bower.json
| - package.json

I copy and past the informations and dependencies from the ember-cli boiler plate, so in my package.json i had just my server dependencies, and now:

"broccoli-asset-rev": "^2.1.2",
"ember-cli": "1.13.8",
"ember-cli-app-version": "0.5.0",
"ember-cli-babel": "^5.1.3",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.0.1",
"ember-cli-htmlbars": "0.7.9",
"ember-cli-htmlbars-inline-precompile": "^0.2.0",
"ember-cli-ic-ajax": "0.2.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.0",
"ember-cli-release": "0.2.3",
"ember-cli-sri": "^1.0.3",
"ember-cli-uglify": "^1.2.0",
"ember-data": "1.13.8",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",

In the bower.json i have:

"ember": "1.13.7",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-data": "1.13.8",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
"ember-qunit": "0.4.9",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18",
"jquery": "^1.11.3",
"loader.js": "ember-cli/loader.js#3.2.1",
"qunit": "~1.18.0"

I already made npm install and bower install, so i have all dependencies installed.

In the ember-cli-build.js i have:

/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    // Add options here
  });

  // Use `app.import` to add additional libraries to the generated
  // output files.
  //
  // If you need to use different assets in different
  // environments, specify an object as the first parameter. That
  // object's keys should be the environment name and the values
  // should be the asset to use in that environment.
  //
  // If the library that you are including contains AMD or ES6
  // modules that you would like to import into your application
  // please specify an object with the list of modules as keys
  // along with the exports of each module as its value.

  return app.toTree();
};

As you can see, i just copy and past the code and dependencies from Ember-CLI.

This is not enough to make Ember CLI works??

In the app.js (see the tree) i have:

import Ember from 'ember'

But is giving me this error:

Uncaught SyntaxError: Unexpected reserved word

What i'm doing wrong here??




Aucun commentaire:

Enregistrer un commentaire