Skip to content

Instantly share code, notes, and snippets.

@kristianmandrup
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristianmandrup/6718631ec36319571da8 to your computer and use it in GitHub Desktop.
Save kristianmandrup/6718631ec36319571da8 to your computer and use it in GitHub Desktop.
Ember DSL idea for ES6 modules
import Ember from 'ember'
module.exports =
controller: (name) ->
unless ['array', 'object'].find name
throw "Invalid Ember controller"
Ember["#{name.camelize}Controller"]
# models/post.js
import model from 'model-dsl'
Post = model
title: attr('string')
count: attr('integer')
# controllers/post.js
import controller from 'controller-dsl'
PostController = controller
actions:
hello: ->
import DS from 'ember-data'
module.export =
model: DS.Model.extend
attr: DS.attr
hasMany: DS.hasMany
belongsTo: DS.hasMany
import Ember from 'ember'
module.exports =
router: Ember.Router.extend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment