Skip to content

Instantly share code, notes, and snippets.

@Mayurifag
Forked from KELiON/application.rb
Created January 16, 2022 20:27
Show Gist options
  • Save Mayurifag/a0facb86be3bb68b605c7829abf34bd8 to your computer and use it in GitHub Desktop.
Save Mayurifag/a0facb86be3bb68b605c7829abf34bd8 to your computer and use it in GitHub Desktop.
Compile all assets from roots
# Precompile all JS/CSS in root of app/assets/stylesheets and app/assets/javascripts
config.assets.precompile +=
Dir[::Rails.root.join('app/assets/*/*.{js,css,coffee,sass,scss}*')].
map { |i| File.basename(i).sub(/(\.js)?\.coffee$/, '.js') }.
map { |i| File.basename(i).sub(/(\.css)?\.(sass|scss)$/, '.css') }.
reject { |i| i =~ /^application\.(js|css)$/ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment