LoginSignup
9
9

More than 5 years have passed since last update.

CoffeeScriptで即時関数メモ

Posted at

忘れがちなので、メモ。

CoffeeScriptで即時関数をつけるときのやり方

do ($ = jQuery , _ = _)->

  some = (arg)->
    console.log arg

CoffeeScriptのコンパイル時に追加されるトップレベルの即時関数を外す場合

bare(-b、--bare)オプションをつけてコンパイルする

$ coffee -c -w -b -o . .

Gruntではbareオプションをtrueにする

Gruntfile.coffee
coffee:
  frontDev:
    options:
      bare: true
    expand: true
    flatten: false
    cwd: 'src/js/'
    src: ['**/*.coffee']
    dest: 'public/js/'
    ext: '.js'

おわり

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9