I intend to introduce a RSpec module to add pre-compilation feature in test mode. To do this, Configuration has to be more configurable per site. For example, base_path, which is a parameter will be introduced later, to address a base directory of each frontend system, has to become configurable per site, if a Rails project has more than one site.
# Note: base_path has not introduced yet.
WebpackManifest::Rails.configuration do |c|
# The settings called within the root configuration scope are enabled in all sites,
# which means enabled in :shop and :admin.
c.cache = !Rails.env.development?
c.add :shop do |co|
# These are enabled only in :shop
co.manifest = Rails.root.join('public', 'assets', 'manifest-shop.json')
co.base_path = Rails.root.join('frontend', 'shop')
end
c.add :admin do |co|
# These are enabled only in :admin
co.manifest = Rails.root.join('public', 'assets', 'manifest-admin.json')
co.base_path = Rails.root.join('frontend', 'admin')
end
This pull request improves Configuration class in advance, with backward compatible.
I intend to introduce a RSpec module to add pre-compilation feature in test mode. To do this,
Configuration
has to be more configurable per site. For example,base_path
, which is a parameter will be introduced later, to address a base directory of each frontend system, has to become configurable per site, if a Rails project has more than one site.This pull request improves
Configuration
class in advance, with backward compatible.