ruby on rails - Why should I have to precompile assets everytime? -


whenever add type of asset (javascript, image or css file, whaterver), gives me error precompile first adding rails.application.config.assets.precompile += %w( ) config/initializers/assets.rb. should solve issue?

the error caused when explicitly reference assets aren't in asset pipeline. specifically:

#app/views/layouts/application.html.erb <%= stylesheet_link_tag :application, "file" %> 

the issue you're calling file has compiled outside normal scope of asset pipeline (concatenating files application.js/application.css:

#app/assets/javascripts/application.js //= require jquery 

the above creates single application.js file referenced files (eg jquery) placed.


this works well, however, if have file.js you're referencing individually, you'll end massive issues if rails cannot find it. thus, prompted add file assets.rb:

#config/initializers/assets.rb rails.application.config.assets.precompile += %w(file) 

you only need refer explicitly referenced files assets.rb (you don't need reference images etc).


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -