I have two different sets of CSS files that I want to use for the same website hosted with heroku.
The first set of CSS files are the standard Twitter BootStrap CSS files converted to SASS.
The second set are custom settings for my application.
I have been able to get the look and feel right on my development server but when I upload it to heroku the output is just
<body>
<head>
</head>
</body>
Please help!
My site is configured as such:
http://imgur.com/S5Aoov1&V3RNQZ3&lSJqpCz&jdSfy82
My controlling layout file is:
doctype 5
html data-uuid=current_user.try(:id)
= render 'head'
= render 'third_party_scripts'
body class=controller_name
= render 'navbar'
= render partial: 'account/infobar'
.container
= render partial: 'flash', locals: { flash: flash }
= yield
I've duplicated this file and named it "_home.html.slim"
I've changed the contents to:
head
title = t('.title', default: 'My Winning Trade')
= stylesheet_link_tag 'home', media: 'all'
= stylesheet_link_tag 'justified-nav', media: 'all'
= stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Shanti|Open+Sans:400,700,800'
= javascript_include_tag 'jquery'
= csrf_meta_tags
The CSS for my landing pages are called home & justified-nav, based on the jumbotron example provided by twitter bootstrap. http://getbootstrap.com/examples/jumbotron/
Heroku Error logs after Asset Precompile:
2013-10-04T19:48:42.124903+00:00 app[web.1]: Completed 500 Internal Server Error in 384ms
2013-10-04T19:48:42.127966+00:00 app[web.1]: 3: = stylesheet_link_tag 'home', media: 'all'
2013-10-04T19:48:42.127966+00:00 app[web.1]:
2013-10-04T19:48:42.127966+00:00 app[web.1]: 1: head
2013-10-04T19:48:42.127966+00:00 app[web.1]: app/views/layouts/sessions.html.slim:3:in `_app_views_layouts_sessions_html_slim__3803347664834042281_69939052542640'
2013-10-04T19:48:42.127966+00:00 app[web.1]: 2: title = t('.title', default: 'My Winning Trade')
2013-10-04T19:48:42.128146+00:00 app[web.1]:
2013-10-04T19:48:42.127966+00:00 app[web.1]: ActionView::Template::Error (home.css isn't precompiled):
2013-10-04T19:48:42.127966+00:00 app[web.1]: 4: = stylesheet_link_tag 'justified-nav', media: 'all'
2013-10-04T19:48:42.127966+00:00 app[web.1]: 5: = stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Shanti|Open+Sans:400,700,800'
2013-10-04T19:48:42.127966+00:00 app[web.1]: 6: = javascript_include_tag 'jquery'
2013-10-04T19:48:42.127966+00:00 app[web.1]: app/views/application/_home.html.slim:3:in `_app_views_application__home_html_slim___3730913017080964654_69939053460220'
2013-10-04T19:48:42.128146+00:00 app[web.1]:
I'm not sure I completely understand what you're asking. But it sounds like:
You have a single layout file.
You want to load a single set of stylesheets in one set of views
In another set of views, you want to additionally load a second stylesheet.
Is that correct? If so, couldn't you just do something like this in your layout:
doctype 5
html data-uuid=current_user.try(:id)
= render 'head'
= render 'head_foobar' if controller_name == 'foobar'
The issue ended up being the home.css file not compiling on the heroku server side.
By changing the production.rb file setting:
from:
config.assets.compile = false
to:
config.assets.compile = true
The layout configuration that #Manishie suggested worked!
Thank you everyone!
Related
Every thing worked fine for me with Redmine 3.3. Now I wanted to upgrade to 3.4.4 and Redmine is no longer running. I searched the internet but did not find the exact same problem. Similar problems where caused by plugins but I do not have any plugins installed. I use the Passenger Docker image of Redmine.
The logs give me the following error message:
Processing by WelcomeController#index as HTML
Current user: anonymous
Redirected to http://0.0.0.0/login?back_url=http%3A%2F%2F0.0.0.0%2F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 60ms (ActiveRecord: 3.7ms)
App 179 stdout:
Started GET "/login?back_url=https%3A%2F%2Fredmine.mydomain.tld%2F" for 95.90.204.176 at 2018-03-14 19:10:26 +0000
Processing by AccountController#login as HTML
Parameters: {"back_url"=>"https://redmine.mydomain.tld/"}
Current user: anonymous
Rendered account/login.html.erb within layouts/base (24.1ms)
Completed 500 Internal Server Error in 219ms (ActiveRecord: 4.3ms)
ActionView::Template::Error (undefined method `default_users_time_zone' for #<Class:0x00000000055f2120>
Did you mean? default_users_hide_mail):
11: <%= favicon %>
12: <%= stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' %>
13: <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
14: <%= javascript_heads %>
15: <%= heads_for_theme %>
16: <%= call_hook :view_layouts_base_html_head %>
17: <!-- page specific tags -->
app/models/user_preference.rb:44:in `initialize'
app/models/user.rb:949:in `pref'
app/helpers/application_helper.rb:1451:in `javascript_heads'
app/views/layouts/base.html.erb:14:in `_app_views_layouts_base_html_erb__2446195152155203147_36658300'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
What could that be? I need to upgrade to 3.4 because I want to use a plugin but the plugin requires version 3.4 in use.
It was my fault! I did not copy every new settings file to my mounted config directory.
Recently, I've been working on migrating my Ruby on Rails site, built on passenger, to a different server, and in the process upgrade rails from 2.3.2 to 3.2. I've installed all necessary gems, and I thought configured everything correctly, but when I go to my site, I get a "We're sorry, but something went wrong" message
I checked the production.log and this is the error message I got:
Connecting to database specified by database.yml
Started GET "/login/login" for ip_address at 2013-05-31 20:12:28 -0400
Processing by LoginController#login as HTML
Rendered login/login.html.erb within layouts/homepage (6.9ms)
Completed 500 Internal Server Error in 43ms
ActionView::Template::Error (defaults.js isn't precompiled):
6:<title>test test test</title>
7: <link rel="icon" type="image/png" href="/images/favicon.ico">
8: <link rel="SHORTCUT ICON" href="/images/favicon.ico"/>
9: <%= javascript_include_tag :defaults %>
10: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
11: <script type="text/javascript" >src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
12: <script type="text/javascript" src="/javascripts/jquery-ui->1.8.20.custom.min.js"></script> <%= stylesheet_link_tag 'home_styles', :media => >'Screen' %>
app/views/layouts/homepage.html.erb:9:in
_app_views_layouts_homepage_html_erb__3199970246383683518_43112000'
I'm still pretty new to Rails, so I'm currently at a bit of a loss what to do. Any help would be appreciated!
<%= javascript_include_tag :defaults %>
This tag is from Rails versions pre 3.1. Are you sure this is what you want to do?
In newer applications, this line is typically including the application JavaScript file instead:
<%= javascript_include_tag "application" %>
This is made possible due to the Asset Pipeline which you can learn about by reading The Asset Pipeline Guide.
As I am working to get ember running I am now failing to get my handlebar templates to load through asset pipeline.
I'm using the handlebars_assets gem, and when I hit the server I get what is below, I verified that the path is correct, but not really sure how to fix this.
When I require handlebars.runtime:
couldn't find file 'handlebars.runtime'
(in /Users/tspore/Rails/Active/tombfinder/app/assets/javascripts/app/ember_app.js:1)
Cache read: sprockets/6f42a4ba0f2b80167ce50f9f306427fa
Compiled app/ember_app.js (5ms) (pid 9791)
Cache read: sprockets/764613d8100bb6d8e6072701f79183c1
Completed 500 Internal Server Error in 141ms
ActionView::Template::Error (can't convert nil into String
(in /Users/tspore/Rails/Active/tombfinder/app/assets/javascripts/app/templates/records/index.hbs)):
26: <% end %>
27:
28:
29: <%= javascript_include_tag 'app/ember_app' %>
30: </head>
31: <body class="<%= #class %>">
32: <div id="center">
app/views/layouts/js.html.erb:29:in `_app_views_layouts_js_html_erb__854441834177334479_70351597254240'
app/controllers/js/js_controller.rb:3:in `index'
Rendered /Users/tspore/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.9ms)
Rendered /Users/tspore/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
Rendered /Users/tspore/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.10/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (3.0ms)
EDIT: After using Github version, and removing the gem from the :assets - it seems to work. But now I am getting this error -
Uncaught ReferenceError: HandlebarsTemplates is not defined records_view.js:4
Uncaught Error: assertion failed: Unable to find view at path 'App.listRecordsView'
My application looks like this -
App.listRecordsView = Ember.View.extend({
templateName: HandlebarsTemplates['records/index'](context)
});
with the ember-rails gem I got the gem to compile so now I have a script called layout.js which looks like this:
Ember.TEMPLATES["app/templates/controller/layout"] = Ember.Handlebars.template(function anonymous(Handlebars, depth0, helpers, partials, data) { helpers = helpers || Ember.Handlebars.helpers; data = data || {};
var buffer = '', stack1, hashTypes, escapeExpression=this.escapeExpression;
data.buffer.push("<h1>from template</h1>\n");
stack1 = {};
hashTypes = {};
stack1 = helpers._triageMustache.call(depth0, "outlet", {hash:stack1,contexts:[depth0],types:["ID"],hashTypes:hashTypes,data:data});
data.buffer.push(escapeExpression(stack1) + "\n");
return buffer;
});
How do I call this template in the Ember App? It has no name space to say:
templateName: 'layout'
Rails 3. I installed compass and I started to modify application.html.haml to convert it from erb to haml.
So far, it does not work. When I refresh the page the layout do not get rendered. It just render the contents of the controllers' view (which is erb).
It is the first time I use Compass, so probably the code is wrong. My question is, where do I see the errors, warning, etc?
I use Passenger.
Edit:
The code is
!!! 5
%html
%head
= stylesheet_link_tag 'compiled/screen.css', :media => 'screen, projection'
= stylesheet_link_tag 'compiled/print.css', :media => 'print'
/[if IE]
= stylesheet_link_tag 'compiled/ie.css', :media => 'screen, projection'
%title
DaVinci - = yield(:title) || " Inicio"
= stylesheet_link_tag 'compiled/modern'
= javascript_include_tag :defaults
= csrf_meta_tag
%body
#header
.navlist
%ul
%li
= link_to 'Inicio', root_path
%li
= link_to 'Administrar', configuration_index_path
%li
= link_to 'Tareas', tasks_path
%li
= link_to 'Documentos', files_path
%li
= link_to 'Correo', emails_path
= yield(:nav)
#contents
= yield
Can I use Tabs instead of spaces?
Compass errors usually show up when you load the page. If the page loads fine, a second option is to view the HTML source of the page, click on the stylesheet loaded into the page, and see if an error is printed into the stylesheet itself. Finally, you can also precompile your sass sheets by running the command
compass watch .
in your root directory. Compilation errors will be written as the output of this command
I'm having an issue with HAML where it is attempting to write to a read-only filesystem (on a Heroku-deployed app).
I can only write to /tmp and /log. How can I configure HAML to write files to the /tmp directory?
Thanks!
Edit:
Output of actual error
Started GET "/" for <ip> at Sun Oct 03 13:19:42 -0700 2010
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.haml within layouts/application (5.6ms)
Completed in 10ms
ActionView::Template::Error (Read-only file system - /disk1/home/slugs/305306_d9977a4_8922/mnt/public/stylesheets/.permissions_check.23729009697080.19743.369932 - Heroku has a read-only filesystem. See http://docs.heroku.com/constraints#read-only-filesystem):
3: %html
4: %head
5: %title= title
6: = stylesheet_link_tag "reset", "application", "grid", :cache => "base"
7: = javascript_include_tag :defaults
8: = csrf_meta_tag
9:
app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml___661334860_23729045526060_0'
Like Mark commented, I think you mean SASS, not Haml. Here's how to use git commit-hooks to precompile your SASS before deploying to heroku.
EDIT: After full error was posted
Change
= stylesheet_link_tag "reset", "application", "grid", :cache => "base"
to
= stylesheet_link_tag "reset", "application", "grid"
The caching isn't HAML, it's RAILS, and it's doing this on first read.