I would like to use the Salesforce Lightning Design System (SLDS) in a Ruby on Rails application, but I cannot figure out how to get any of the styles to render. Has anyone had experience using SLDS in a rails applicaiton?
I've never used SLDS, but adapting the basic tutorial I got a basic (static) page with styles going in a few minutes using Sprockets. There's various options documented for installing the framework, so this is just the way I picked as opposed to the only way:
/assets
directory into your app under vendor/assets
.config/initializers/assets.rb
to load assets from the vendor directory (if you don't already):Rails.application.config.assets.paths << Rails.root.join('vendor/assets')
app/assets/stylesheets/application.css
: *= require_tree .
*= require_self
*= require salesforce-lightning-design-system
As I said, this is just a simple way via the Sprockets asset pipeline. If you are installing the framework via yarn and packaging CSS with Webpacker instead of Sprockets, you'll need to import the style into a stylesheet pack and include it with a stylesheet_pack_tag
, etc.