Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember

Ember - JavaScript Application Framework

  • 1.0.0-pre.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-5.71%
Maintainers
1
Weekly downloads
 
Created
Source

Ember for Node

Ember.js is a framework for building ambitious client-side applications on the web. Now you can use the same Ember tools in node code and in node-based asset pipelines like Convoy.

Using This Package

Just add ember as a requirement to your package.json:

"dependencies": {
  ...
  "ember": "~0.9"
}

In your code, you can load the entire Ember stack by just requiring the package. This will add Ember to the global namespace in your application.

require('ember');

MyApp = Ember.Application.create({
  hi: function() { console.log('Hi! I'm an app!'); }
});

If you don't want to use the entire Ember stack, you can just require the specific module that you want. For example, a lot of server side code just needs States for statecharting:

require('ember/states');

MyState = Ember.State.create({
  
});

Using Ember with Convoy

Building an Ember application in the browser is very easy when using Convoy. Just require ember in your main application file.

// In some JS module included by convoy:
require('ember'); // <- convoy will automatically pull in all of Ember.

UserView = Ember.View.extend({
  template: Ember.Handlebars.compile('{{firstName}} {{lastName}}')
});

If you want to store your Handlebars templates in a separate file, Ember for Node has a HandlebarsCompiler that will precompile the templates for you. Here is an example Convoy pipeline configuration:

pipeline = convoy({
  'app.js': {
    packager: 'javascript',
    compilers: {
      '.hbr': require('ember/packager').HandlebarsCompiler
    }
  }
});

app = express.createServer();
app.use(pipeline.middleware());

This will now make .hbr files available as modules. In your app code, you can load the template via a normal require:

// user_view.js

require('ember/views');

UserView = Ember.View.extend({
  template: require('./user_template') // template in user_template.hbr
});

For a fully functioning example of an application, check out the examples folder.

Building From Source

This project checks out the ember source and builds compiled copies for use in the released version. If you want to rebuild this from source, here is what you need to do:

  1. Make sure you have node.js and Jake installed globally. Once you have node.js installed you can install jake with the command [sudo] npm install -g jake
  2. Also make sure you have Ruby 1.9.3 or later installed as well as bundler. Once you have ruby installed you can install bundler with [sudo] gem install bundler
  3. Clone the node-ember repo
  4. From the repo directory run jake vendor:setup. This should checkout the correct versions of ember and ember-data and set them up to build
  5. Run jake diet to actually build the assets.

Note that you only need to run vendor:setup once the first time you install the report or anytime the version of ember or ember-data changes. Afterwards, you should be able to run dist just to rebuild.

ember and ember-data are linked into this project as git submodules. To update to a newer (or older) version of ember or ember-data, cd into the vendor directory and checkout the version you want. Then cd back to the top level of the repo and commit the updates into git. Once completed, run jake vendor:setup again to update the contents.

IMPORTANT: The dist command will checkout whichever version of ember or ember-data are set in the submodule, so you must commit to git before rebuilding.

FAQs

Package last updated on 15 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc