CoffeeScript 導入
インストール
$ sudo npm install -g coffee-script
Grunt で使えるようにする
https://github.com/gruntjs/grunt-contrib-coffee https://github.com/vojtajina/grunt-coffeelint
npm intall grunt-contrib-coffee --save-dev
npm intall grunt-coffeelint --save-dev
Gruntfile.js に以下のように書いてみる
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-coffeelint');
...
grunt.initConfig({
coffee: {
main: {
files: {
'js/smoothscroll.js': '_coffee/*.coffee',
}
}
},
coffeelint: {
// DOC: https://github.com/vojtajina/grunt-coffeelint
// DOC: http://www.coffeelint.org/
// app: [ '_coffee/*.coffee' ],
tests: {
files: {
src: [ '_coffee/*.coffee' ]
},
options: {
'no_trailing_whitespace': {
'level': 'error'
}
}
}
},
...
watch: {
coffee: {
files: [ '_coffee/*.coffee' ],
tasks: [ 'coffee' ]
},
coffeelint: {
files: [ '_coffee/*.coffee' ],
tasks: [ 'coffeelint' ]
}
}
});
grunt.registerTask('default', [ 'coffee', 'coffeelint', 'watch' ]);
};
Vim に vim-coffee-script プラグイン追加
https://github.com/kchmck/vim-coffee-script
これでシンタックスハイライトやら、簡易文法チェックが走るようになる