I wish to precompile all the CSS and JS files in my project\'s app/assets
folder. I do NOT want to precompile everything in vendor/assets or lib/assets, only th
This will get all .css
.scss
and .js
including all files in subdirectories.
js_prefix = 'app/assets/javascripts/'
style_prefix = 'app/assets/stylesheets/'
javascripts = Dir["#{js_prefix}**/*.js"].map { |x| x.gsub(js_prefix, '') }
css = Dir["#{style_prefix}**/*.css"].map { |x| x.gsub(style_prefix, '') }
scss = Dir["#{style_prefix}**/*.scss"].map { |x| x.gsub(style_prefix, '') }
Rails.application.config.assets.precompile = (javascripts + css + scss)