CoffeeScript in 5mins

2,808 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,808
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
17
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

CoffeeScript in 5mins

  1. 1. CoffeeScript in 5mins @mackato - 2011.09.14 #izakaya.js11 9 15
  2. 2. “CoffeeScript is a little language that compiles into JavaScript.”11 9 15
  3. 3. Pros less code compile-time code check compiles into pure JavaScript11 9 15
  4. 4. Cons require compile process little strange syntax debugging is too hard, yet.11 9 15
  5. 5. Use Case Rails 3.111 9 15
  6. 6. Use Case Any other JavaScript Frameworks11 9 15
  7. 7. JS to CoffeeScript $(document).ready(function() { init(); some(); $("a.link").click(function() { $(this).fadeOut("slow", function () { $(this).remove(); }); }); });11 9 15
  8. 8. JS to CoffeeScript $(document).ready(function() { init() some() $("a.link").click(function() { $(this).fadeOut("slow", function () { $(this).remove() }) }) })11 9 15
  9. 9. JS to CoffeeScript $(document).ready function() init() some() $("a.link").click function() $(this).fadeOut "slow", function () $(this).remove()11 9 15
  10. 10. JS to CoffeeScript $(document).ready -> init() some() $("a.link").click -> $(this).fadeOut "slow", -> $(this).remove()11 9 15
  11. 11. JavaScript build is necessary without CoffeeScript concatenate <script src="/javascripts/jquery.js"></script> <script src="/javascripts/jquery.min.js"></script> <script src="/javascripts/application.js"></script> <script src="/javascripts/all.js"></script>11 9 15
  12. 12. JavaScript build is necessary without CoffeeScript minify (function( window, undefined ) { var document = window.document, navigator = window.navigator, location = window.location; (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9? a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f(" +">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"|| d===""){ck|| (ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c11 9 15 .appen
  13. 13. JavaScript build is necessary without CoffeeScript concatenate minify js js js js js11 9 15
  14. 14. JavaScript build is necessary without CoffeeScript compile concatenate minify coffee js coffee js js js coffee js11 9 15
  15. 15. Cons require compile process # not cons little strange syntax debugging is too hard, yet.11 9 15

×