LoginSignup
6
3

More than 5 years have passed since last update.

hamlでアノテーション(rake notes)を利用する方法

Last updated at Posted at 2017-06-17

アノテーションって便利ですよね〜、TODOとかFIXMEとかHACKとか書いてあとでrake notesするだけで一覧することが出来ます。

:参考
http://qiita.com/tbpgr/items/1c046a877c6be4d89876

デフォルトでスキャンしてくれる拡張子は
.builder、.rb、.rake、.yml、.yaml、.ruby、.css、.js、.erbなのですが、それ以外にもしてほしいときが有りますよね〜。

そんなときは

config.annotations.register_extensions("scss", "sass", "less") { 
|annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ }

こんな感じで書き込めばいいよ〜、Rails Guidesに書いてありました。

そこでconfig/environments/development.rbとかにでも書けばいいのかな〜、と思ったら違いました。

正しくはRakefileです。Rakefileに書きましょう。

こんな感じに書くことになります。

Rakefile
SourceAnnotationExtractor::Annotation.register_extensions("haml") {
 |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }

情報源は例によってstackoverflow
https://stackoverflow.com/questions/32492734/rake-notes-should-scan-haml

6
3
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
6
3