CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement.
P.S. My undying gratitute to the contributors — thank you!
Years of being wished for, finally granted!
result = range 1, 3
.concat range 4, 6
.map (x) -> x * x
.filter (x) -> x % 2 is 0
console.log result # [4, 16, 36]$ 'body'
.click (e) ->
$ '.box'
.fadeIn 'fast'
.addClass '.active'
.css 'marginRight', '10px'These two both solve roughly the same problem:
jashkenas/coffeescript#3246 jashkenas/coffeescript#3256
This'll finally let you wrap long strings (e.g. user-facing messages) without breaking your code's indentation, or manually stripping newlines out. I've been wanting this for so long!
console.log '
Hello world.
This is a long line of text
that I’d like split in my code.
'
# equivalent to:
console.log 'Hello world. This is a long line of text that I’d like split in my code.'console.log '''
By default, prefixed CSS will rewrite original files.
If you didn't set input files, autoprefixer will \
read from stdin stream.
Output CSS will be written to stdout stream on \
`-o -' argument or stdin input.
'''
# equivalent to:
desc = '''
By default, prefixed CSS will rewrite original files.
If you didn't set input files, autoprefixer will read from stdin stream.
Output CSS will be written to stdout stream on `-o -' argument or stdin input.
'''- the power operator
**, - the floor division operator
//and - the (correct) modulo operator
%%.
Not a huge deal to most people, but I've frequently wondered about this.
regex = /// <link\ href="#{URL}" ///Like Streamline.js and others, extending Node's require() to automatically compile CoffeeScript files is now an explicit action. This now prevents versioning conflicts, etc. with nested local CoffeeScript dependencies.
# if you're working with the compiler programmatically:
CoffeeScript = require 'coffee-script'
CoffeeScript.register()
# or, e.g. for Mocha configuration
require 'coffee-script/register'
Great! But still there are some goodies missing for some reason: