user1381745
user1381745

Reputation: 3900

Rails assets pipeline - not precompiling subdirectory

In both assets/stylesheets and assets/javascripts, I have a folder called admin, which has a handful of appropriate Coffeescript and SASS files.

$ cat app/assets/javascripts/admin.js 
//= require jquery
//= require jquery_ujs
//= require_tree ./admin

$ cat app/assets/stylesheets/admin.css 
/*
*= require_self
*= require_tree ./admin
*/

$ cat config/application.rb | grep 'assets.paths'
config.assets.paths << "#{Rails.root}/app/assets/stylesheets/admin"
config.assets.paths << "#{Rails.root}/app/assets/javascripts/admin"

After precompiling, the admin folders (and their contents) are nowhere to be seen in public/assets.

I'm probably making a fundamental mistake here; I've done very little playing with the pipeline besides the basics of images, application.js etc.

Can anyone point out what I'm doing wrong?

Upvotes: 1

Views: 2087

Answers (1)

stfcodes
stfcodes

Reputation: 1380

From what i can see, they are manifests. By default only application.css and application.js are precompiled. Other need need to be added.

You need to add them to the production.rb environment as follows (comment is from the file itself):

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( admin.css admin.js )

Also, you can ditch the config.assets.paths in your application.rb, because those paths are loaded by default.

Upvotes: 2

Related Questions