I purchased a free template and I'm applying it to my blog's main page. I created an admin for this blog and I have a question if my organization of assets is correct. Here is the structure:
admin.js // make the call from the admin dir, it works normally
And the call inside application.js looks like this:
//= require jquery //= require jquery_ujs //= require turbolinks //= require template/js/jquery.poptrox.min.js //= require template/js/skel.min.js //= require template/js/init.js
admin.css //call the admin dir, it works normally
And the call inside application.css looks like this:
*= require template/css/skel.css *= require template/css/style.css *= require template/css/style-xlarge.css *= require_self
and in the application.html.haml layout I make the reference of application.css and application.js. My question is if this organization is correct because I was reading in the guide and I see that it has the public and vendor folder for css and js but I don't know when to use it.
The organization within the assets folder can look like this (as described in the documentation sent in 2.2 Asset Organization)
app/assets for the app's own assets.
lib/assets to their own libraries, and which do not fall within the scope of the application or libraries shared with another application
That is to say assets placed in public still work and are served as static files depending on your settings. Asset files are automatically served, after being precompiled, in public/assets when in production.
In production, Rails precompiles these files to public/assets by default. The precompiled copies are then served as static assets by the web server. The files in app/assets are never served directly in production.