-
Notifications
You must be signed in to change notification settings - Fork 253
Using Sprockets to compile javascript assets
Justin Coyne edited this page Oct 7, 2019
·
5 revisions
By default (in Blacklight 7) the assets generator adds the following things to your application to enable Sprockets to build a javascript bundle:
Added to the Gemfile:
gem 'bootstrap', '~> 4.0'
gem 'popper_js'
gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript'
These requires are injected into app/assets/javascripts/application.js:
//= require jquery3
//= require popper
//= require twitter/typeahead
//= require bootstrap
If you are using Uglifier in production (rails default) and you encounter this error:
Uglifier::Error: Unexpected token: operator (>). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
Then change this line in config/environments/production.rb:
config.assets.js_compressor = :uglifierto
config.assets.js_compressor = Uglifier.new(harmony: true)