I am using requirejs-railsversion 0.9.8 for Rails 4.0.13. I ran into a problem when requirejs merges all my JS files but doesn't reduce them.
Here is my requirejs.yml file:
paths:
'react' : 'react/react-with-addons'
'react-dom' : 'react/react-dom'
'react-router' : 'react-router/index'
'react-router-shim' : 'react-router-shim/react-router-shim'
'jquery' : 'jquery/dist/jquery'
'lodash' : 'lodash/lodash'
'flux' : 'flux/dist/Flux'
'es6-promise' : 'es6-promise/promise'
'event-emitter' : 'eventemitter2/lib/eventemitter2'
'object-assign' : 'object-assign/object-assign'
'async' : 'requirejs-plugins/src/async'
'moment' : 'moment/min/moment-with-locales.min'
'bootstrap' : 'bootstrap/bootstrap.min'
'material' : 'material-kit/material.min'
'material-kit' : 'material-kit/material-kit'
'jquery' : 'jquery/jquery.min'
shim:
'react-router-shim':
exports: 'React'
'react-router':
deps: ['react-router-shim']
exports: 'ReactRouter'
'material-kit':
deps: ['jquery', 'material', 'bootstrap']
'material':
deps: ['jquery', 'bootstrap']
'bootstrap':
deps: ['jquery']
exports: 'jquery'
'lodash':
exports: '_'
'object-assign':
exports: 'ObjectAssign'
And after starting up rake assets:precompile RAILS_ENV=production, I look in public/assetsfor the file application-HASHand see that it is just a large file with all the JS concatenations. Here is also my file production.rb:
App::Application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = true
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.assets.digest = true
config.assets.version = '1.1'
config.force_ssl = true
config.log_level = :info
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
end
EDIT
It seems that it requirejs-railssuccessfully changes my JS files individually in my application tmp/requirejs/dst, but these files are not merged together to create a file application-HASH.js.
source
share