• Stars
    star
    875
  • Rank 51,045 (Top 2 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generators and build tools for Ember applications

Ember Tools

NOTICE: ember-tools is not currently maintained. If you want to maintain the project, contact @fivetanley or @rpflorence, if there is any interest. If you're starting a new project, using Ember CLI is recommended instead.

Build Status

demo

Installation

npm install -g ember-tools

Don't have node or npm? Visit http://nodejs.org.

Features

  • prescribed file organization for sanity
  • scaffolding for learning curve mitigation
  • template precompilation for performance
  • single file application build for convenience
  • generators for faster application development
  • commonjs (node-style) modules

Version Information

Current Version: 0.2.7

Package versions:

  • ember v1.0.0
  • ember-data v0.13
  • handlebars v1.0.0
  • jQuery 1.9.1

Quickstart

npm install -g ember-tools
ember create my-app
cd my-app
ember generate --scaffold person name:string age:number
ember build
open index.html # Mac OS
xdg-open index.html # Linux
start index.html # Windows
# visit #/people

The first place to get started is configuring a route in config/routes.js and then adding a template for the route.

Usage

You can always run ember --help or ember [command] --help to get usage information.

  Usage: ember [command] [options]

  Command-Specific Help

    ember [command] --help

  Commands:

    create [options]       creates a new ember application at [dir]
    build [options]        compiles templates and builds the app
    generate [options]     generates application files
    precompile [options]   precompile templates from src dir to target dir
    update [version]       Update ember.js from ember's s3 build service to [version].
             Versions are latest(built from master, bleeding edge) and stable.
             Default version is stable.
  Options:

    -h, --help     output usage information
    -V, --version  output the version number

Guide

Creating Stand-Alone Browser Apps

If you are creating a stand-alone browser application (no server, or communication is through some api service) then use:

ember create my-app

  • javascript assets created in my-app/js
  • ember commands run from my-app root

Or if you already have the my-app directory, cd into it and call ember create bare:

ember create

  • javascript assets created in ./js
  • ember commands run from ./ root

There is nothing magical about the index.html file. Feel free to replace it with your own (you probably should). Just make sure you include a script tag pointing to js/application.js

Creating Browser Apps as Part of Express or Rails (etc.)

If you are creating an ember app as part of a server-side framework like express or ruby on rails use the --js-path option.

cd my-server-app
ember create --js-path public/javascripts
  • javascript assets created in my-server-app/public/javascripts
  • ember commands run from my-server-app root

Running ember build will create a file at public/javascripts/application.js. Require that in your server-app's template, no other files are required.

Building Your App

The build command pre-compiles all the templates to simple functions, assigns all your modules to the App object based on their file names, and then creates a single, concatenated file to be included in your app.

ember build

This build step makes adding new modules to your app as simple as creating a file with the generate command. It will convert the file path to an object, ie: controllers/recipe -> App.RecipeController, routes/recipes/index -> App.RecipesIndexRoute.

To build when files in your app change, use the --watch option:

ember build -w

If you want to inspect the objects being assigned to the App object you can build without cleanup using the --no-cleanup, -c option and then opening up the index.js file it creates:

ember build -c

You can also specify the path of the resulting application file to save it somewhere other than the default path.

ember build --out-file public/whatever.js

Of course, you can combine any of these options:

ember build -wc --out-file public/whatever.js

Scaffolding

I am not super proud of the scaffolding, but it gets your feet wet with ember really quickly, so use it for fun, not profit :P

ember generate --scaffold time_sheet description:string minutes:number

Generators

Ember tools provides generators for the different ember objects your app will use. Basic usage is:

ember generate [options] [name]

So creating a recipe route would look like:

ember generate --route recipe

Or the shorter version:

ember generate -r recipe

If you have a route, you probably want a template too; you can combine generator options:

ember generate -rt recipe

Below is a list of all generator commands the the files and objects they create.

Generator Examples

options object name file
--model, -m burrito Burrito models/burrito.js
--view, -v burrito BurritoView views/burrito_view.js
--controller, -c post/comments PostCommentsController controllers/post/comments_controller.js
--template, -t post/comments n/a templates/post/comments.handlebars
--route, -r taco_cart TacoCartRoute routes/taco_cart_route.js
--mixin, -x tacoable Tacoable mixins/tacoable.js
--helper, -l all_caps allCaps helpers/all_caps.js
--component, -p my-widget MyWidgetComponent components/my_widget_component.js
templates/components/my-widget.hbs
-mvcrt tacos Taco
TacosView
TacosController
TacosRoute
models/taco.js
views/tacos_view
controllers/tacos_controller.js
routes/taco_route.js
templates/tacos.handlebars

Notes:

  • Models will always be singular.
  • Sub-directories will be created for you if they don't exist.
  • Components must have a dash per web component standards.

Precompiling Handlebars Templates for Ember

The build command already pre-compiles your templates, but you can use the precompile command outside of the rest of ember-tools. To precompile a bunch of templates found at views/jst to assets/javascripts/templates.js run this command:

ember precompile -d views/jst -f assets/javascripts/templates.js

This will register each template on Ember.TEMPLATES with file paths for keys.

Upgrading from 0.1.x to 0.2.x

  1. Rename .ember to ember.json
  2. Edit ember.json to point to the right jsPath, should look something like:
    {
      "jsPath": "js",
      "modules": "cjs"
    }
  3. Move routes.js, app.js, and store.js to config/<filename>.js
  4. Add dependencies to config/app.js, it should look something like this:
    require('../vendor/jquery');
    require('../vendor/handlebars');
    require('../vendor/ember');
    require('../vendor/ember-data');
    
    var App = Ember.Application.create();
    App.Store = require('./store');
    
    module.exports = App;

That should do it.

License and Copyright

MIT Style License

Copyright © 2013 Ryan Florence

Contributing

Run tests with:

npm test

and the browser sanity tests:

npm run-script browser

Its usually easiest to create a branch and send a pull request against that branch instead of master. Single commits are preferred (no big deal though, I can squash and cherry-pick).

Thanks for using ember-tools!

More Repositories

1

react-training

Mini React Training Course
JavaScript
1,012
star
2

async-props

Co-located data loading for React Router
JavaScript
566
star
3

example-react-router-server-rendering-lazy-routes

JavaScript
559
star
4

react-router-mega-demo

WIP Move Along
JavaScript
471
star
5

react-magic-move

JavaScript
447
star
6

render-markdown-javascript

Renders markdown files to HTML with highlighted code blocks BUT ALSO RENDERS THE JAVASCRIPT ONES.
JavaScript
435
star
7

reactconf-2015-HYPE

JavaScript
348
star
8

react-lumberjack

Logging setState for React
JavaScript
279
star
9

snack

A tiny, cross-browser, JavaScript library.
JavaScript
245
star
10

gatsby-source-firebase

Gatsby plugin to turn Firebase into a Gatsby data source.
JavaScript
149
star
11

github-plusone-extension

JavaScript
124
star
12

react-title-component

Nested document title management for React.js
JavaScript
121
star
13

SlideShow

Extensible mid-level MooTools slideshow class that manages transitions of elements that share the same space, typically for slideshows, tabs, and galleries.
JavaScript
106
star
14

remix-planner

TypeScript
95
star
15

loom

Weave your wefts betwixt the warps of loom generators and scaffolds
JavaScript
92
star
16

react-router-relative-links

JavaScript
77
star
17

react-router-restore-scroll

JavaScript
75
star
18

jquery-rf-slideshow

Super flexible, low-level jQuery slideshow built on the jquery.widget system
JavaScript
61
star
19

CSSAnimation

CSS Transitions and Transforms with JavaScript
JavaScript
60
star
20

non-trivial-js

An example on how to build and structure a non-trivial JavaScript application.
JavaScript
60
star
21

moo4q

MooTools Object Oriented Classes for jQuery
JavaScript
57
star
22

advanced-react-workshop

JavaScript
51
star
23

firebase-schema

Schema for your Firebase
JavaScript
44
star
24

jsconf2014

JavaScript
41
star
25

react-router-apply-middleware

Composable middleware for React Router
JavaScript
40
star
26

limescripts

LimeChat JavaScript
JavaScript
40
star
27

publisher.js

Publish / Subscribe for JavaScript
JavaScript
36
star
28

react-clone

Declarative element cloning for React.js
JavaScript
33
star
29

webpack-node-demo

Tiny boilerplate to run a node app through webpack first
JavaScript
27
star
30

react-router-named-routes

Finally, they're back!
25
star
31

create-container

Simple application container
JavaScript
25
star
32

react-router-contacts

JavaScript
24
star
33

rf-changelog

create changelogs for git repos
JavaScript
21
star
34

remix-blog-vercel

JavaScript
21
star
35

broccoli-dist-es6-module

Author in ES6, distribute everywhere.
JavaScript
20
star
36

rf-release

tag, push, and publish to npm and bower
JavaScript
20
star
37

ember-amd-boilerplate

JavaScript
19
star
38

bower-import

wip, move along :)
JavaScript
19
star
39

nested-router

JavaScript
18
star
40

addressbook-api

An address book api
JavaScript
16
star
41

FitText

Truncates lines of text to fit within a container
JavaScript
16
star
42

loom-generators-ember

Loom generators with ES6 ember modules
JavaScript
15
star
43

todo-api

An API for your favorite Todo demos
CoffeeScript
15
star
44

client-vs-server-templating

WHICH IS BETTER?! I DONT KNOW!
Ruby
15
star
45

lunchjs-flux

JavaScript
14
star
46

js-stylesheet

Write styles in JavaScript for simpler component distribution.
JavaScript
13
star
47

jQuery.addObject

This method allows you to add a JavaScript constructor to the jQuery, and then manage the state of an instance with the jQuery API
JavaScript
13
star
48

remix-architect

TypeScript
12
star
49

mootools-channels

An extended, natural publish subscribe system for MooTools.
JavaScript
12
star
50

netlify-starter

WIP
TypeScript
12
star
51

raziel

command-line password management
JavaScript
11
star
52

bbesnpm

...
JavaScript
11
star
53

LazyPagination

Automatically sends ajax requests as the user scrolls an element.
JavaScript
11
star
54

planner2

He does.
TypeScript
10
star
55

Fx.Scroll.Carousel

Extends Fx.Scroll to provide carousel functionality.
JavaScript
10
star
56

modern-advanced-react-workshop

Workshop material for https://reach.tech/workshops
10
star
57

bnpm

better npm
Shell
9
star
58

webpack-skel

template for new projects
JavaScript
9
star
59

mootools-element-filters

A declarative approach to element behavior.
JavaScript
9
star
60

detect-amd

Detect AMD support in JavaScript source files
JavaScript
9
star
61

Loop

A utility funciton used to run a class method on a periodical.
JavaScript
8
star
62

garuda

Git-hosting-server-side ruby library of scripts used to deploy multiple repositories to multiple web servers.
Ruby
8
star
63

wannabe-mvc

A Wannabe MVC in PHP
PHP
8
star
64

fifo

Graceful localStorage
CoffeeScript
8
star
65

mootools-wallpaper

Resizes elements to fit or fill a container
JavaScript
8
star
66

remix-content-blocks

JavaScript
8
star
67

talk-emberconf-2014

my "slides"
JavaScript
7
star
68

mootools-string-inflections

Several methods to convert strings back and forth between "railsish" names. Helpful when creating JavaScript heavy rails (or similar MVC) apps.
JavaScript
7
star
69

talks

Talks I've given
JavaScript
7
star
70

listener

A no frills cross-browser DOM event listener with ender integration
JavaScript
6
star
71

mootools-base64

String methods for encoding and decoding Base64 data
JavaScript
6
star
72

unbundled

JavaScript
6
star
73

mootools-template

Packager and a whole lotta packages ready for you.
PHP
6
star
74

advise.js

Aspect Oriented Programming for JavaScript Objects
JavaScript
6
star
75

basic-cf-pages-template

Basic Cloudflare Pages template
JavaScript
6
star
76

talk-react-js-utah-2014-10-28

Building an application in, and then around, React components.
JavaScript
5
star
77

x_1

TypeScript
5
star
78

vercel-test

JavaScript
5
star
79

webpack-help

JavaScript
5
star
80

ember-addon-kit

Boilerplate repository for creating ember addons
JavaScript
5
star
81

gunnlod

super slick markdown editor for any static site
JavaScript
5
star
82

hmr-test

JavaScript
5
star
83

rackt-datepicker

JavaScript
4
star
84

fs-routes

move along
JavaScript
4
star
85

detect-globals

Detect browser globals in JavaScript source files.
JavaScript
4
star
86

broccoli-es6-module-filter

Transpiler ES6 authored modules to other module types
JavaScript
4
star
87

hilite

Syntax highlighter written in JavaScript
JavaScript
4
star
88

rjbb

RequireJS Boilerplate with AMD versions of jQuery, Underscore, and Backbone
JavaScript
4
star
89

Resizable

Creates resizable user interface elements, stores and retrieves positions from cookies, and each instance is aware of neighboring instances so the resizable limits are dynamically set to avoid resizing over each other
JavaScript
4
star
90

jQuery.dojo

Everything in dojo, brought to jQuery!!!!!!11
3
star
91

accessibility-in-practice

JavaScript
3
star
92

list-app

make quick checklists, usually from my wife's text message shopping lists
Shell
3
star
93

originate

Command line tool that generates new project scaffolds with loom
JavaScript
3
star
94

punchclock

A simple JavaScript time tracker app
JavaScript
2
star
95

Element.GetUntil

Element methods for selecting sibling and parent nodes up to but not including a matched element from a selector.
JavaScript
2
star
96

city-search

JavaScript
2
star
97

mootools-hash-events

Fire all sorts of events onhashchange for all browsers
JavaScript
2
star
98

test

2
star
99

indie-syd

TypeScript
2
star
100

mootools-custom-form

Custom form controls
JavaScript
2
star