Hello all, I''m trying to understand how to include a stylesheet that is inside a sub directory in my css assets folder. The folder to include is app/assets/css/fonts - folder of fonts and a stylesheet.css 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) 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/7uhhzUkD9BcJ. For more options, visit https://groups.google.com/groups/opt_out.
Vell
2013-Apr-16 20:03 UTC
Re: Asset not precompiled error even though log shows it compiled
On Tuesday, April 16, 2013 3:51:37 PM UTC-4, Vell wrote:> > Hello all, > > I''m trying to understand how to include a stylesheet that is inside a sub > directory in my css assets folder. > > The folder to include is app/assets/css/fonts - folder of fonts and a > stylesheet.css >****Sorry guys. I failed to mention that this is a rails 3.2.12 app running ruby uby-1.9.3-p392> > 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) > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/5iAM-RP9SVYJ. For more options, visit https://groups.google.com/groups/opt_out.
Frederick Cheung
2013-Apr-17 07:14 UTC
Re: Asset not precompiled error even though log shows it compiled
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 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/pafchyBqaTwJ. For more options, visit https://groups.google.com/groups/opt_out.
Bigos
2013-Apr-17 08:58 UTC
Re: Asset not precompiled error even though log shows it compiled
I had this problem yesterday. I my /app/views/layouts/application.html.haml I had folowing: = stylesheet_link_tag "application", :media => "all" = stylesheet_link_tag "style", :media => "all" Removing stylesheet_link_tag "style", :media => "all" has solved the problem. So in your case probably you have to remove something like: stylesheet_link_tag "fonts" On Tuesday, 16 April 2013 20:51:37 UTC+1, Vell wrote:> > Hello all, > > I''m trying to understand how to include a stylesheet that is inside a sub > directory in my css assets folder. > > The folder to include is app/assets/css/fonts - folder of fonts and a > stylesheet.css > > 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) > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/orRC2J_M4swJ. For more options, visit https://groups.google.com/groups/opt_out.
Vell
2013-Apr-17 13:39 UTC
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Vell
2013-Apr-17 13:42 UTC
Re: Asset not precompiled error even though log shows it compiled
On Wednesday, April 17, 2013 4:58:55 AM UTC-4, Bigos wrote:> > I had this problem yesterday. > > I my /app/views/layouts/application.html.haml I had folowing: > = stylesheet_link_tag "application", :media => "all" > = stylesheet_link_tag "style", :media => "all" > > Removing stylesheet_link_tag "style", :media => "all" has solved the > problem.I just took a look at my application.html.erb file and saw that I had the following: <%= stylesheet_link_tag "application", media: "all" %> <%= stylesheet_link_tag "fonts/stylesheet.css" %> <%= javascript_include_tag "application" %> I will remove that second line and see if things compile properly.> So in your case probably you have to remove something like: > stylesheet_link_tag "fonts" > > > On Tuesday, 16 April 2013 20:51:37 UTC+1, Vell wrote: >> >> Hello all, >> >> I''m trying to understand how to include a stylesheet that is inside a sub >> directory in my css assets folder. >> >> The folder to include is app/assets/css/fonts - folder of fonts and a >> stylesheet.css >> >> 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) >> >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TFRysqyWRPAJ. For more options, visit https://groups.google.com/groups/opt_out.
Vell
2013-Apr-17 13:50 UTC
Re: Asset not precompiled error even though log shows it compiled
On Wednesday, April 17, 2013 9:42:17 AM UTC-4, Vell wrote:> > > > On Wednesday, April 17, 2013 4:58:55 AM UTC-4, Bigos wrote: >> >> I had this problem yesterday. >> >> I my /app/views/layouts/application.html.haml I had folowing: >> = stylesheet_link_tag "application", :media => "all" >> = stylesheet_link_tag "style", :media => "all" >> >> Removing stylesheet_link_tag "style", :media => "all" has solved the >> problem. > > > I just took a look at my application.html.erb file and saw that I had the > following: > > <%= stylesheet_link_tag "application", media: "all" %> > <%= stylesheet_link_tag "fonts/stylesheet.css" %> > <%= javascript_include_tag "application" %> > > I will remove that second line and see if things compile properly. >So removing that link gave me a different error An ActionView::Template::Error occurred in ..... search-image.png isn''t precompiled actionpack (3.2.13) lib/sprockets/helpers/rails_helper.rb:142:in `digest_for'' So I think I am probably over the hurdle for now. Hopefully I can figure out this particular issue and be on my way :) Thanks for the advice and understanding guys!> > > > >> So in your case probably you have to remove something like: >> stylesheet_link_tag "fonts" >> >> >> On Tuesday, 16 April 2013 20:51:37 UTC+1, Vell wrote: >>> >>> Hello all, >>> >>> I''m trying to understand how to include a stylesheet that is inside a >>> sub directory in my css assets folder. >>> >>> The folder to include is app/assets/css/fonts - folder of fonts and a >>> stylesheet.css >>> >>> 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) >>> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/c8Db3rojL3kJ. For more options, visit https://groups.google.com/groups/opt_out.