I have external files css
, javascript
and Images
in 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/js
to app/assets/javascript
and for css
copied external-assets/css
to 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 css
and 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 post
like: 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 js
and css
on config.assets.precompile
.
Questions
1) Do I need to mention all the files js
, css
and 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_tag
for js exists stylesheet_link_tag
. What about images?
user5060176
source
share