Rails: using rake: notes for javascript

Is there a way to configure rake: notes to parse javascript files and highlight the corresponding notes? Thanks

+6
source share
2 answers

You can do this with grep directly if you want

grep -r 'OPTIMIZE:\|FIXME:\|TODO:' public/javascripts 

If you need only TODO

 grep -r 'TODO:' public/javascripts # Find on todos 

You can use the following to search for all js in a project, not just files under open javascripts.

 grep -r 'OPTIMIZE:\|FIXME:\|TODO:' **/*.js 

Here's how you can turn this into a rake challenge.

 # File lib/tasks/notes.rake namespace :notes do task :js do puts `grep -r 'OPTIMIZE:\\|FIXME:\\|TODO:' public/javascripts` end end 

Now you can run rake notes:js from the root of the project.

+12
source

In Rails 4.2, you already have javascript annotation support, although if you want to add anodals for other extensions, add this line to your config/application.rb file:

 config.annotations.register_extensions("ext1", "ext2", "txt3") { |annotation| /\/\/\s*(#{annotation}):?\s*(.*)$/ } 
0
source

Source: https://habr.com/ru/post/887020/


All Articles