vendredi 3 février 2017

Ruby on rails files setup

I have some doubts about the folders on which I should put the public files.
We got at the root path a folder called public and some other folders in app (rails 5.0.1 for me), let me show you the ones which sound strange for me:

  • app/assets/ (images | javascripts | stylesheets)
  • app/views/pages

After reading multiple tutorials and existing public projects, I saw that some people put his web template in public (js, css and images included).
Yet, in my case, because of I have seen it few times too and found it logic, I have put my template in assets separating my js, sass (in my case) files, and images in the folders already created by the RoR generator.

Additionnal, it seems logic for me to put my files in assets because my main layout gonna take my template files in assets with the framework default API. The following line works for me and gonna load my app/assets/stylesheets/ app.css.scss file

<%= stylesheet_link_tag    'app', media: 'all', 'data-turbolinks-track': 'reload' %>

Hope someone could explain what's the better way, I'm beginner with Rails, thanks.




Aucun commentaire:

Enregistrer un commentaire