2016-08-14 14 views
1

これは私を夢中にしています - rake assets:precompileを実行すると、私のレールサイトでのCSSの変更のみがアップデートされます。アセットがコンパイルされない

誰でもこれを修正する方法を知っているので、資産が変更されるとコンパイルされますか?

私は問題がこの設定/環境/ development.rbファイルである直感を持っている:ここでは

Rails.application.configure do 
    # Settings specified here will take precedence over those in config/application.rb. 
    config.assets.compile = true 
    # In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the web server when you make code changes. 
    config.cache_classes = false 

    # Do not eager load code on boot. 
    config.eager_load = false 

    # Show full error reports and disable caching. 
    config.consider_all_requests_local  = true 
    config.action_controller.perform_caching = false 

    # Care if the mailer can't send. 
    config.action_mailer.raise_delivery_errors = true 

    # Print deprecation notices to the Rails logger. 
    config.active_support.deprecation  = :log 
    config.action_mailer.delivery_method  = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.default_url_options = { :host => "http://localhost:3000/" } 
    # SMTP settings for gmail 
    config.action_mailer.smtp_settings = { 
    address:    'smtp.gmail.com', 
    port:     587, 
    domain:    'gmail.com', 
    user_name:   ENV['gmail_username'], 
    password:    ENV['gmail_password'], 
    authentication:  'plain', 
    enable_starttls_auto: true 
    } 

    # Raise an error on page load if there are pending migrations. 
    config.active_record.migration_error = :page_load 

    # Debug mode disables concatenation and preprocessing of assets. 
    # This option may cause significant delays in view rendering with a large 
    # number of complex assets. 
    config.assets.debug = true 

    # Asset digests allow you to set far-future HTTP expiration dates on all assets, 
    # yet still be able to expire them through the digest params. 
    config.assets.digest = true 

    # Adds additional error checking when serving assets at runtime. 
    # Checks for improperly declared sprockets dependencies. 
    # Raises helpful error messages. 
    config.assets.raise_runtime_errors = true 

    # Raises error for missing translations 
    # config.action_view.raise_on_missing_translations = true 
end 

は私の資産/スタイルシート/ application.cssファイルの先頭である:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 
* 
* You're free to add application wide styles to this file and they'll appear at the bottom of the 
* compiled file so the styles you add here take precedence over styles defined in any styles 
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new 
* file per style scope. 
* 
*= require_tree . 
*= require_self 
*/ 

と同様にapplication.jsのトップ:

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// compiled file. 
// 
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 
// about supported directives. 
// 
//= require jquery 
//= require jquery_ujs 
//= require_tree . 

編集:私はremovたら、私はこれが唯一の問題になったことを追加する必要がありますedブートストラップ...

+0

あなたが投稿したenvironments/development.rbファイルにすべて問題はないと思います。あなたのapp/assets/stylesheets/application.cssとapp/assets/javascripts/application.jsファイルはどのようなものですか? – kcdragon

+2

あなたの問題は開発モードのままですか? 'rake assets:clobber'を試しましたか?' public/assets'フォルダを手で削除しましたか?私が正しく覚えていれば、レールはまず資産を調べる前に事前にコンパイルされたバージョンを提供します。 – slowjack2k

+0

何を@ slowjack2kと言う! – phoet

答えて

0

上記のコメントセクションを参照してください。

関連する問題