Rake任务,用于在Rails目录中编译较少的表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rake任务,用于在Rails目录中编译较少的表相关的知识,希望对你有一定的参考价值。

Code for a Rake task that allows compiles all LESS stylesheets (.less) contained within a single directory.
  1. desc "Compiles all .less files in the stylesheets directory of a Rails application"
  2. task :less do
  3.  
  4. require 'less'
  5.  
  6. directory = 'public/stylesheets/'
  7. stylesheets = Dir.entries(directory)
  8.  
  9. stylesheets.each do |sheet|
  10. if(File.extname(sheet) == ".less")
  11. `lessc #{directory + sheet}`
  12. end
  13. end
  14. end

以上是关于Rake任务,用于在Rails目录中编译较少的表的主要内容,如果未能解决你的问题,请参考以下文章