More Related Content
Similar to CoffeeScript in 5mins
Similar to CoffeeScript in 5mins (20)
More from Masakuni Kato (13)
CoffeeScript in 5mins
- 3. Pros
less code
compile-time code check
compiles into pure JavaScript
11 9 15
- 4. Cons
require compile process
little strange syntax
debugging is too hard,
yet.
11 9 15
- 6. Use Case
Any other JavaScript Frameworks
11 9 15
- 7. JS to CoffeeScript
$(document).ready(function() {
init();
some();
$("a.link").click(function() {
$(this).fadeOut("slow", function () {
$(this).remove();
});
});
});
11 9 15
- 8. JS to CoffeeScript
$(document).ready(function() {
init()
some()
$("a.link").click(function() {
$(this).fadeOut("slow", function () {
$(this).remove()
})
})
})
11 9 15
- 9. JS to CoffeeScript
$(document).ready function()
init()
some()
$("a.link").click function()
$(this).fadeOut "slow", function ()
$(this).remove()
11 9 15
- 10. JS to CoffeeScript
$(document).ready ->
init()
some()
$("a.link").click ->
$(this).fadeOut "slow", ->
$(this).remove()
11 9 15
- 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. 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),c
11 9 15 .appen
- 13. JavaScript build is necessary
without CoffeeScript
concatenate minify
js
js js js
js
11 9 15
- 14. JavaScript build is necessary
without CoffeeScript
compile concatenate minify
coffee js
coffee js js js
coffee js
11 9 15
- 15. Cons
require compile process # not cons
little strange syntax
debugging is too hard,
yet.
11 9 15