Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
rails_material_design_icons
Advanced tools
Rails Material Design Icons provides the Material Design Icons web fonts and stylesheets as a Rails engine for use with the asset pipeline.
Most of the work was done in Font Awesome gem, this just changes the files to Material Design Icons. Font Awesome Rails
Add this to your Gemfile:
gem "rails_material_design_icons"
and run bundle install
.
In your application.css
, include the css file:
/*
*= require materialdesignicons
*/
Then restart your webserver if it was previously running.
Congrats! You now have scalable vector icon support. Pick an icon and check out the official website for the icons available. https://materialdesignicons.com/.
If you prefer SCSS, add this to your
application.css.scss
file:
@import "materialdesignicons";
If you use the
Sass indented syntax,
add this to your application.css.sass
file:
@import materialdesignicons
There are also some helpers (mdi
and mdi_spin
) that make your
views icontastic!
mdi "sheep"
# => <i class="mdi mdi-sheep"></i>
mdi_spin # spinning icons!
# => <i class="mdi mdi-sheep mdi-spin"></i>
It is sometimes the case that deploying a Rails application to a production
environment requires the application to be hosted at a sub-folder on the server.
This may be the case, for example, if Apache HTTPD or Nginx is being used as a
front-end proxy server, with Rails handling only requests that come in to a sub-folder
such as http://example.com/myrailsapp
. In this case, the
FontAwesome gem (and other asset-serving engines) needs to know the sub-folder,
otherwise you can experience a problem roughly described as "my app works
fine in development, but fails when I deploy
it".
To fix this, set the relative URL root for the application. In the
environment file for the deployed version of the app, for example
config/environments/production.rb
,
set the config option action_controller.relative_url_root
:
MyApp::Application.configure do
...
# set the relative root, because we're deploying to /myrailsapp
config.action_controller.relative_url_root = "/myrailsapp"
...
end
The default value of this variable is taken from ENV['RAILS_RELATIVE_URL_ROOT']
,
so configuring the environment to define RAILS_RELATIVE_URL_ROOT
is an alternative strategy.
In addition you need to indicate the subfolder when you precompile the assets:
RAILS_ENV=production bundle exec rake assets:precompile RAILS_RELATIVE_URL_ROOT=/myrailsapp
FAQs
Unknown package
We found that rails_material_design_icons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.