2. About me
@danielsju6 Boston, MA
Entrepreneur & Rails Developer; Founder of
@marginleft, @accelgolf, lead on @appblade, over
user of CamelCase, and a @techstars Boston Alum
8. The problem
• Third-party code mixed into yours
• JS/CSS/IMG treated as second class citizens
• Organization is fucked
• JavaScript in views
• Who uses :cache => true anyway
18. Coffeescript... meh
• Language that compiles to javascript
hopefully Mark convinced you and me on this
# Assignment: # Objects:
number = 42 math =
opposite = true root: Math.sqrt
square: square
cube: (x) -> x * square x
# Conditions:
number = -42 if opposite # Splats:
race = (winner, runners...) ->
# Functions: print winner, runners
square = (x) -> x * x
# Existence:
alert "I knew it!" if elvis?
# Arrays:
list = [1, 2, 3, 4, 5]
# Array comprehensions:
cubes = (math.cube num for num in list)
19. Javascript compression
• config.assets.js_compressor = :uglifier
• Uses execjs which needs to have a
javascript runtime
node.js, ‘therubyracer’, ‘mustang’, etc.
24. Production
• Pre-compilation
• Capistrano
before :"deploy:symlink", :"deploy:assets";
desc "Compile asets"
task :assets do
run "cd #{release_path}; RAILS_ENV=#{rails_env} bundle exec rake assets:precompile"
end
25. That’s all folks
• gem install rails --pre
• Rails guides are being updated