Skip to content

Create sourcemaps when compressing assets in your Rails 3.2 applications.

License

Notifications You must be signed in to change notification settings

placeit-envato/uglifier_with_source_maps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UglifierWithSourceMaps

Create sourcemaps when compressing assets in your Rails 3.2 applications.

This gem uses Uglifier to create sourcemaps for your concatenated javascripts in Rails 3.2.x. It is meant to use as a replacement javascript compressor.

Note: This gem is for Rails 3.2.x

For Rails 4.2 see: https://github.com/AlexanderPavlenko/sprockets_uglifier_with_source_maps

Installation

Add this line to your application's Gemfile:

gem 'uglifier_with_source_maps'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uglifier_with_source_maps

Usage

In your rails applications environment configuration add this:

config.assets.js_compressor = :uglifier_with_source_maps

If you need to pass options to uglifier:

config.assets.js_compressor = UglifierWithSourceMaps::Compressor.new({
  output: {
    beautify: true, indent_level: 2, comments: :none
    }
  }) if defined? ::UglifierWithSourceMaps

Your assets will be built as normal, and maps concatenated sources will be provided as well in asset_path/maps and asset_path/sources

Example rake assets:precompile

# application.js
rake assets:precompile

# -> public/assets/application-ab258eecc169e5febb9da42389481bff.js
# -> public/assets/maps/application-ab258eecc169e5febb9da42389481bff.map
# -> public/assets/sources/application-ab258eecc169e5febb9da42389481bff.js

Dependencies

  • uglifier >= 2.5
  • sprockets ~> 2.2.2
  • actionpack ~> 3.2.18

Contributing

  1. Fork it ( https://github.com/[my-github-username]/uglifier_with_source_maps/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Create sourcemaps when compressing assets in your Rails 3.2 applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%