Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6041551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:40:41+00:00 2026-05-23T06:40:41+00:00

The rails 3.1 has as default a great gem named uglifier for js minification.

  • 0

The rails 3.1 has as default a great gem named uglifier for js minification.

To enable it, we just have to call

config.assets.js_compressor  = :uglifier

I’m working in another project, rails 3.0, and I want to use as well the same gem. I searched already some info, but i couldn’t not find any direction. Something that i found, in the rdoc is

require 'uglifier'
Uglifier.new.compile(File.read("source.js"))
# => js file minified

I can write a rake task maybe to execute it, it’s fine, but there is any other way?

update:

i’m using barista and coffeescript, so maybe there is something that i can add to barista to generate the js already minified

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:40:42+00:00Added an answer on May 23, 2026 at 6:40 am

    Barista has hooks. If you look at your config/initializers/barista_config.rb, it tells you what all the hooks are. So, for example, I decided not to go with Jammit but instead minify using the JSMin gem. Inside my barista_config.rb I put this:

    Barista.configure do |c|
      c.on_compilation do |path|
        if Rails.env.production?
          puts "+++ Barista: Compressing #{path} for production environment +++"
          compressible = File.read(path)
          File.open(path, 'w'){|f| f.write(JSMin.minify(compressible))}
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails has a nice idiom that makes it easy for you to have a
We have a Rails app that has some pages that are available to all
I am using the active_admin gem in my Rails 3 application, which has as
I'm just wondering if rails has any inbuilt way of determining the correct http
OS X 10.6 has Rails 2.2.2 installed by default. How to upgrade to Rails
I am using Rails 3.0.2 which has protect_from_forgery by default in application_controller.rb. I wanted
I want my Rails rest application has json as default output format , also
If my Rails application has the database pool size set to 5 (the default)
I'm using an out-dated version of rails (2.2). I have a page which has
Rails has no way of creating foreign keys in migrations (there are plugins to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.