Gem that will carry and deploy AMA assets.
- Run
bundle install - Setup the
.envfiles by running these commands from the ama_styles directory:
ln -s ~/src/rails_envs/ama_styles/.env.development .env.developmentln -s ~/src/rails_envs/ama_styles/.env.staging .env.stagingln -s ~/src/rails_envs/ama_styles/.env.production .env.production
- Checkout a new branch
- Add your styles changes
- Update the
ama_stylesgem version. - Commit and push
- Review and merge
- Deploy using
bin/assets ENVIRONMENT deploy(Replace environment with: staging, production)
- Add
gem 'ama_styles', git: 'git@github.com:amaabca/ama_styles.git'to your Gemfile. - Extract any application-specific styles into
application.css(remove any references toama_layout/application). - Add this line to your
layouts/application.html.erbfile (and any other layout files):
<%= stylesheet_link_tag Rails.configuration.stylesheet_resolver.asset_path, media: "all" %>- Add to config/application.rb: one version for all environments. If a version is not specified it will default to ama_styles_default_version.
config.ama_styles_version = 'v3'- Add to config/application.rb: different versions based on environment
config.ama_styles_version = config.app_env == 'production' ? 'v2' : 'v3'- Add to initializers/assets.rb
Rails.configuration.stylesheet_resolver.version = Rails.configuration.ama_styles_version # optional
Rails.configuration.stylesheet_resolver.remote = Rails.env.production?
Rails.configuration.assets.paths << File.join(
Gem.loaded_specs['ama_styles'].full_gem_path,
'app',
'assets',
'stylesheets',
Rails.configuration.stylesheet_resolver.version
)
Rails.configuration.assets.precompile += %W(#{Rails.configuration.stylesheet_resolver.version}/shared.css)- Add the
ASSET_CLOUDFRONT_URLvariable to the relevant.envfile for the application. - Set the
cloudfront_urlconfiguration option in an initializer/application.rb:
Rails.configuration.cloudfront_url = ENV['ASSET_CLOUDFRONT_URL']If you need to push a branch to production/staging you must disable remote assets under
initializers/assets.rb Rails.configuration.stylesheet_resolver.remote = false
This will trigger compilation of your assets instead of using AWS cloudfront.
** NOTE ** Remember to update ama_styles gem in the app after deploying to master to get new assets
Font Awesome icons will now be served up via the fa kit in the ama_layout v11.3.0 partial ama_layout_partial('font_awesome_pro_kit')
The gem is available as open source under the terms of the MIT License.