Jason Swett Jason Swett - 1 year ago 184
AngularJS Question

Include stylesheets using browserify-rails

I'm using browserify-rails to include Angular UI Grid in my Rails project. My

contains the following:


This works in the sense that includes
, but it doesn't handle any of the stylesheets.

How can I get Angular UI Grid's stylesheets into my application as well?

Answer Source

The JavaScript includes and CSS includes are handled separately.

Your require('angular-ui-grid') call above handles the JS side of things since it's in the application.coffee manifest file.

To include the stylesheets, you'll need an additional require in the application.scss (or whichever file is your main CSS manifest).

browserify-rails does not include the node_modules directory in its asset load paths by default, so you have to add it inside the assets.rb file like this

# Add additional assets to the asset load path
# Rails.application.config.assets.paths << "node_modules"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download