How to Use this Code
You can look at the commit history to understand all the steps I took to gereate this starter kit. I have documented all the commands I used in the commit log. I also briefly summarize my edits to the files.
- I start by generating a boilerplate rails app using the
- Then I add the necessary gems, create an empty controller that will act as an app container.
- Then I add the code from the starter kit and organize it in the right file structure.
Indentation based languages use appropriate indentation to establish hierarchy of the code instead of using commas, semicolons and curly braces. Python and YAML are popular examples of such languages.
Emberjs is a rich-client web-application framework. This means a lot of the computation is done on the client side, but still we need a server setup to do a few things.
- Deliver the static code (scripts, css, html templates, images... etc)
- Provide a CRUD/REST interface to persist data on the server side. This is needed to store data across client sessions.
- Provide authentication, authorization etc security features. These cannot be implemented on the client side because anyone can modify code on the clientside.
Rails is a good choice to get started with. This is because Emberjs developers are also developing rails gems(libraries) that follow Emberjs developments in lock-step. Also Rails is a fully featured, widely used, actively developed, well documented, community driven web framework.
However Rails conventions mainly focus on serverside MVC framework. Most of it will be unused by us and Emberjs will implement client side code conventions within
rails generate ember:bootstrap.
emblem-rails is actually server side implementation of the emblem.js feature. It works only on files with .emblem extensions that reside in
app/assets/ . It parses these files (e.g.
x-emblem template within an html page (hosted as
app/views/<controller>/page.html.erb) then it will not be parsed. The embedded x-emblem template can only be parsed by client-side use of
emblem.js. You might be able to use emblem-source gem to get that(I haven't tried this yet), or you can build emblem.js from source and put it within the
It seems that the convention is to use emblem on the server side. This probably improves performance by pre-parsing the emblem templates. This also makes things convenient by having
.emblem files associated with emblem syntax so we can use syntax highlighter.
Rails has great built-in support for coffee script. Any
application.js is an important file and part of the rails convention. We can add
CSS: Todo for you
Rails has great support for using Sass which has a very neat indentation based syntax. However it's non indented Scss syntax seems more popular. I haven't provided any exampl of converting existing
.css file to either
.sass file. I'm certain you can handle that.