Coder Social home page Coder Social logo

kristianmandrup / ember-cli-emberscript Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 57 KB

Adds precompilation of EmberScript files and all the basic generation types to the ember generate command.

License: MIT License

EmberScript 40.14% JavaScript 58.96% CoffeeScript 0.90%

ember-cli-emberscript's Introduction

EmberScript support for ember-cli

Adds precompilation of EmberScript files and all the basic generation types to the ember generate command.

Includes

  • Generating files in EmberScript with ember generate
  • Preprocessing EmberScript-files in your app

Install

npm install ember-cli-emberscript --save-dev

Should work with ember-cli version 0.0.44 and up (if not let me know).

How to use

Run ember help generate to get a list of available blueprints. Use them by running ember g <blueprint> <args>, for instance ember g controller pants type:array

EmberScript version

Currently, the multi-compile version of EmberScript is used to allow for multi script languages to co-exide and be compiled separately for a single file. This is to overcome when EmberScript adds certain variables to the top (see issue #44

  "dependencies": {
    ...
    "ember-script": "git://github.com/kristianmandrup/ember-script#0.0.17"
  }

Script file layout

The basic layout of a file is like this. In thee blueprints, (ember) is used as the emberscript indicator, but you might as well use simply (em).

See more info @ emberscript multicompile.

  • coffeescript: cs, coffee
  • javascript: js, ecma
  • livescript: ls, live
  • emberscript: em, ember

By convention, the first fragment will then be treated as normal coffeescript and be compiled separately before the emberscript (or whatever) coming after. This allows you to easily insert ES6 module statements where you want etc.

Please check out the README for more details and customisation options.

class Post
  # ...

`export default Post`

Status

Promising!!

Roadmap

Let me know what you would like to see...

ember-cli-emberscript's People

Contributors

kimroen avatar kristianmandrup avatar razor-x avatar rwjblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-cli-emberscript's Issues

Error: Ember.ENV should be an object

On a newly generated app, I've got the following package.json:

  "devDependencies": {
    "broccoli-asset-rev": "^2.0.0",
    "ember-cli": "git://github.com/ember-cli/ember-cli.git#master",
    "ember-cli-app-version": "0.3.1",
    "ember-cli-babel": "^4.0.0",
    "ember-cli-content-security-policy": "0.3.0",
    "ember-cli-dependency-checker": "0.0.7",
    "ember-cli-emberscript": "git://github.com/kristianmandrup/ember-cli-emberscript#master",
    "ember-cli-emblem-hbs-printer": "^0.2.0",
    "ember-cli-htmlbars": "0.7.4",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-less": "^1.2.0",
    "ember-cli-qunit": "0.3.8",
    "ember-cli-uglify": "1.0.1",
    "ember-data": "1.0.0-beta.15",
    "ember-export-application-global": "^1.0.2",
    "express": "^4.8.5",
    "glob": "^4.0.5"
  }
}

And this is what I get when I build:

assertion failed: Ember.ENV should be an object.
Error: assertion failed: Ember.ENV should be an object.
    at Object.Ember.assert (C:\Users\borde_000\Desktop\trapsmart\client\node_mod
ules\ember-cli-emberscript\node_modules\broccoli-ember-script\node_modules\ember
-script\lib\ember-runtime.js:52:20)
    at C:\Users\borde_000\Desktop\trapsmart\client\bower_components\ember\ember-
template-compiler.js:182:11
    at requireModule (C:\Users\borde_000\Desktop\trapsmart\client\bower_componen
ts\ember\ember-template-compiler.js:66:65)
    at requireModule (C:\Users\borde_000\Desktop\trapsmart\client\bower_componen
ts\ember\ember-template-compiler.js:62:24)
    at C:\Users\borde_000\Desktop\trapsmart\client\bower_components\ember\ember-
template-compiler.js:7365:1
    at Object.<anonymous> (C:\Users\borde_000\Desktop\trapsmart\client\bower_com
ponents\ember\ember-template-compiler.js:7367:3)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

Compilation error on Ember CLI 1.13

Hello,
I have the following issue during compilation:

version: 1.13.8
Build failed.
File: orion/controllers/application.em
Ember is not defined
ReferenceError: Ember is not defined
at get (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/ember-runtime.js:1924:3)
at Array.Ember.Enumerable.Ember.Mixin.create.find (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/ember-runtime.js:8129:15)
at class$.exports.Compiler.cache$2 (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:1109:41)
at class$. (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2437:86)
at class$.exports.Compiler.Compiler.compile.walk (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2349:19)
at class$. (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2335:27)
at class$.exports.Compiler.Compiler.compile.walk (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2340:11)
at class$. (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2335:27)
at class$.exports.Compiler.Compiler.compile.walk (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2340:11)
at class$.exports.Compiler.Compiler.compile.walk (/home/andrei/ember/orion/node_modules/ember-cli-emberscript/node_modules/broccoli-ember-script/node_modules/ember-script/lib/compiler.js:2340:68)

The issue can be fixed if comment line ember-runtime.js:1924:
//Ember.assert("You need to provide an object and key to get.", !!obj && keyName);

If try to use computed property 'Ember is not defined' error emerges again in the other place - compiler.js.
The issue can be fixed if do the following comment but it is only dirty fix due to uniq() function not running:
chains = /*Ember.A(*/this.dependentKeys().map(function (c) { return c.join('.'); })/*).uniq()*/; return emberComputedProperty(fn, chains); } else {...

Whether Ember.A function usage is correct in the compiler.js? It seems it is the single place of usage Ember in this file.

Could you please explain the reason of such mistake and describe how correct them more natural?
Thanks.

Fails to install because of `broccoli-ember-script` dependency

I'm getting the following error:

npm ERR! Failed resolving git HEAD (git://github.com/kristianmandrup/ember-script.git) fatal: ambiguous argument 'mc': unknown revision or path not in the working tree.

Apparently because the multicompile branch at brocoli-ember-script points to the non-existent mc branch at ember-script (I checked your forks, let me know if I'm mistaken).

EmberScript compilation doesn't work

Not sure what the issue is, but a fresh Ember CLI install with this addon doesn't seem to work out of the box. I have to add my own dependency to broccoli-ember-script and manually call require('broccoli-ember-script')(app.toTree()) in my Brocfile.js. I was under the assumption that this would act like other pre-processor addons (i.e. It Just Works™).

The blueprints/generators work though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.