I have external files css, javascriptand Imagesin a separate project, and you want to include in my new project rails. Here is my folder structure:
external-assets/js/ <Files>
external-assets/js/plugin/<Files>
external-assets/css/<Files>
external-assets/css/plugins/<Files>
external-assets/images/<some Folders>/<Files>
external-assets/images/<Files>
So, I copied the folder external-assets/jsto app/assets/javascriptand for csscopied external-assets/cssto app/assets/stylesheets.
and replace <link rel="icon" href="external-assets/css/plugins/bootstrap.min.css">with <%= stylesheet_link_tag "/plugins/bootstrap.min.css" %>in my file html.erb. I did the same for other files cssand js. When I start the server, I got this error:
Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( style.css )` to `config/initializers/assets.rb` and restart your server
After searching in SO postlike: The object is filtered and will not be serviced: add `config.assets.precompile and the
object is Filtered and will not be serviced . I need to list all of my files jsand csson config.assets.precompile.
Questions
1) Do I need to mention all the files js, cssand Images? I know the reason, but I have a lot of resource files.
2) What if I put them in a folder public? Is this a good approach?
3) For css, javascript_link_tagfor js exists stylesheet_link_tag. What about images?
user5060176
source
share