[Rails] Re: Asset not precompiled error even though log shows it compiled
On Wednesday, April 17, 2013 3:14:10 AM UTC-4, Frederick Cheung wrote:
On Tuesday, April 16, 2013 8:51:37 PM UTC+1, Vell wrote:
>
> In my app/assets/css/application.css.scss I have included the following line:
>
> *= require fonts/stylesheet.css
>
> Then when I precompile I get the following:
>
> Compiled fonts/stylesheet.css (0ms) (pid 30638)
>
This means that the compiled application.css contains the result of compiling fonts/stylesheet.scss
The error you're seeing indicates that you're link directly to fonts/stylesheet.css (ie the produced HTML contains a <link> tag whose href is pointing at that file.
If you want to be able to link to css or javascript like this you need to add the file to the list of items to precompile separately ( there's a setting for this in production.rb). Alternately you could just link to application.css
Thanks for the response Frederick.
I did see in my application.rb that I could add
config.assets.paths << "#{Rails.root}/app/assets/stylesheets/fonts"
config.assets.precompile += ["fonts/stylesheets.css"]
but both gave me the same error as in my first post. Am I specifying this incorrectly somehow?
How would I do the alternative linking to application.css if all else fails?
--
Fred
>
> But when I hit my app from the browser I get the following:
>
>
>
> An ActionView::Template::Error occurred in ......:
>
>
> fonts/stylesheet.css isn't precompiled
> actionpack (3.2.13) lib/sprockets/helpers/rails_helper.rb:142:in `digest_for'
>
>
> So I guess my questions is, what is the proper way to include this stylesheet (and font files) so that all works as it should and I don't have to hack around this.
>
>
> Any help is greatly appreciated.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/q_C4tnxFVewJ.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home