Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
CoffeeScript and Less
Search
Daniel Shearmur
April 18, 2013
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CoffeeScript and Less
Daniel Shearmur
April 18, 2013
More Decks by Daniel Shearmur
See All by Daniel Shearmur
SIPP2 Front-end Optimisations
danshearmur
0
89
Front-end Workshop
danshearmur
0
140
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
570
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Done Done
chrislema
186
16k
Faster Mobile Websites
deanohume
310
32k
GraphQLとの向き合い方2022年版
quramy
50
15k
Thoughts on Productivity
jonyablonski
76
5.3k
A Soul's Torment
seathinner
6
3.4k
BBQ
matthewcrist
89
10k
Transcript
None
None
None
BAD
var x = 10; x = 10
functions square = (x) -> x * x cube =
(x) -> square(x) * x cube 4 # same as cube(4)
objects singers = {Jagger: "Rock", Elvis: "Roll"} kids = brother:
'paul' sister: 'jane'
arrays primes = [2, 3, 5, 7, 11, 13] frontEnders
= [ 'dans' 'zsuzsa' 'gib' ]
loops eat food for food in ['toast', 'cheese', 'wine'] for
el in document.querySelectorAll('h2') el.style.display = "none" for key, val of window console.log key, val
conditionals if happy and knowsIt clapHands() else showIt() action =
if isHidden then "show" else "hide" doThings() unless x == 10
classes class Animal constructor: (@name) -> move: (meters) -> alert
@name + " moved #{meters}m." class Snake extends Animal move: -> alert "Slithering..." super 5
splats curryFirst = (fn, first) -> (rest...) -> fn.apply(null, [first].concat(rest))
None
None
variables @primary: #fa0000; a, a:visited { color: @primary; }
mixins .bordered(@colour: black) { border-top: dotted 1px @colour; border-bottom: solid
2px @colour; } #menu a { color: #111; .bordered; } .post a { color: red; .bordered(pink); }
nesting .form-row { .clearfix; .textbox { border: 1px solid black;
&:active { border-color: blue; } } }
operations @base: 5%; @filler: @base * 2; @other: @base +
@filler;
colour functions lighten(@color, 10%); darken(@color, 10%);
import @import url('some.css'); /* bad*/ @import 'some.less'; /* good */