Skip to content

Instantly share code, notes, and snippets.

@Panioglo
Forked from Chocksy/precompile_assets.rb
Created March 26, 2018 11:30
Show Gist options
  • Save Panioglo/cccf53851dae7ae76b8e51a658ed6543 to your computer and use it in GitHub Desktop.
Save Panioglo/cccf53851dae7ae76b8e51a658ed6543 to your computer and use it in GitHub Desktop.

Revisions

  1. @Chocksy Chocksy created this gist Sep 7, 2016.
    11 changes: 11 additions & 0 deletions precompile_assets.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # use this file in the rails app root directory and run it with
    # ruby precompile_assets.rb to see if there is any error in your
    # js file assets by using Uglifier. This would save you from running
    # rake assets:precompile and using production as env var.
    require './config/environment'

    JS_PATH = 'app/assets/javascripts/**/*.js'.freeze
    Dir[JS_PATH].each do |file_name|
    puts "\n#{file_name}"
    puts Uglifier.compile(File.read(file_name))
    end