簡體   English   中英

Rails CSS沒有使用Heroku加載

[英]Rails CSS not Loading using Heroku

更新 :完整的網站代碼在這里 - https://github.com/eWizardII/PeerInstruction

我在Heroku上設置了以下站點 - http://www.peerinstruction.net/users/sign_up問題是我已經更新了css但它沒有在網站上積極反映,它只顯示了一個文本框,使用一些編輯/自定義字體。 我已將css文件附加在以下要點中 - https://gist.github.com/f74b626c54ecbb60bbde

注冊頁面控制器:

!!! Strict
%html
  %head
    %title= yield(:title) || "Untitled"
    = stylesheet_link_tag 'application', 'web-app-theme/base', 'web-app-theme/themes/activo/style', 'web-app-theme/override'
    = javascript_include_tag :defaults
    = csrf_meta_tag
    = yield(:head)
  %body
    #container
      #header
        %h1
          %a{:href => "/"} Peer Instruction Network
        #user-navigation
          %ul.wat-cf
            %li
              .content.login
                .flash
                  - flash.each do |type, message|
                    %div{ :class => "message #{type}" }
                      %p= message
                = form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "form login" }) do |f|
                  .group.wat-cf
                    .left= f.label :email, :class => "label right"
                    .right= f.text_field :email, :class => "text_field"
                  .group.wat-cf
                    .left= f.label :password, :class => "label right"
                    .right= f.password_field :password, :class => "text_field"
                  .group.wat-cf
                    .right
                      %button.button{ :type => "submit" }
                        Login
              /= link_to "Sign In", destroy_user_session_path
      #box
        = yield

注冊頁面haml文件:

%h2
.block
  .content.login
    .flash
      - flash.each do |type, message|
        %div{ :class => "message #{type}" }
          %p= message
      = form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
        = devise_error_messages!
        %div
          = f.label :firstname
          %br/
          = f.text_field :firstname
        %div
          = f.label :middlename
          %br/
          = f.text_field :middlename
        %div
          = f.label :lastname
          %br/
          = f.text_field :lastname
        %div
          = f.label :email
          %br/
          = f.email_field :email
        %div
          = f.label :password
          %br/
          = f.password_field :password
        %div
          = f.label :academic
          %br/
          = f.text_field :academic
        %div= f.submit "Continue"
      = render :partial => "devise/shared/links"

我使用web-app-theme創建一個activo主題,然后進行修改。

這是你的工作應用程序

我必須做一些事來解決它。

首先,我把它放在雪松堆上,這很重要。

然后,更改Gemfile至關重要。 我做了一個要點我所做的有,但總之我感動到sqlite3的開發和測試ENVS,和我刪除了rubyracer寶石。

我認為這就是我所做的一切。

我養成了刪除不再被使用的編譯資產的習慣,因為它們只會占用public/assets大量空間

驗證了你的css ,它提出了很多關於無效屬性的警告。

我懷疑它正在服務的內容與文檔中的內容之間存在某種字符集不匹配。 由於CSS沒有解析,所以CSS都不起作用。

幾乎沒有問題,overide.css不是沒有找到。 你有404:

http://www.peerinstruction.net/assets/web-app-theme/override.css

確保在您的assets / stylesheets / application.css中包含web-app-theme / override.css並運行:

RAILS_ENV=production rake assets:precompile

在你推到heroku之前

我剛剛得到“css資產沒有加載在Heroku上”。

我的問題是我忘了在本地編譯資產 - 如果在你的應用中檢測到public/assets/manifest.yml你必須這樣做。 此文件的存在告訴Heroku您自己正在處理資產編譯,並且不會嘗試編譯您的資產。

請參閱Heroku Cedar上的Rails 3.1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM