CoffeeScript in 5mins

Post on 01-Dec-2014

2,817 views 2 download

description

 

transcript

CoffeeScript in 5mins@mackato - 2011.09.14 #izakaya.js

11年9月15日木曜日

“CoffeeScript is a little languagethat compiles into JavaScript.”

11年9月15日木曜日

Pros

less codecompile-time code check

compiles into pure JavaScript

11年9月15日木曜日

Cons

require compile process

little strange syntax

debugging is too hard, yet.

11年9月15日木曜日

Use CaseRails 3.1

11年9月15日木曜日

Use CaseAny other JavaScript Frameworks

11年9月15日木曜日

JS to CoffeeScript$(document).ready(function() { init(); some(); $("a.link").click(function() { $(this).fadeOut("slow", function () { $(this).remove(); }); });});

11年9月15日木曜日

JS to CoffeeScript$(document).ready(function() { init() some() $("a.link").click(function() { $(this).fadeOut("slow", function () { $(this).remove() }) })})

11年9月15日木曜日

JS to CoffeeScript$(document).ready function() init() some() $("a.link").click function() $(this).fadeOut "slow", function () $(this).remove()

11年9月15日木曜日

JS to CoffeeScript$(document).ready -> init() some() $("a.link").click -> $(this).fadeOut "slow", -> $(this).remove()

11年9月15日木曜日

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日木曜日

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("<"+a+">").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.body.appen11年9月15日木曜日

JavaScript build is necessary without CoffeeScript

concatenate minify

js

js

js

js js

11年9月15日木曜日

JavaScript build is necessary without CoffeeScript

concatenate minify

js

js

js

coffee

coffee

coffee

js js

compile

11年9月15日木曜日

Cons

require compile process # not cons

little strange syntax

debugging is too hard, yet.

11年9月15日木曜日