3
I bought a free template and am applying on my main blog page. I created an admin for this blog and I’m wondering if my Assets organization is correct. Follow the structure:
app/Assets/Avascripts:
admin
template
admin.js //calls dir admin, works normally
application js
And the call inside the application.js is so:
//= 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
app/Assets/stylesheets:
admin
template
admin.css //calls dir admin, works normally
application css.
And the call inside the application.css is like this:
*= require template/css/skel.css
*= require template/css/style.css
*= require template/css/style-xlarge.css
*= require_self
and in the layout application.html.haml I reference application.css and application.js. My question is if this organization is the correct pq was reading in the guide and I see that you have the public folder and vendor for css and js but I don’t know when to use.
Thanks for the feedback gave to understand how it works. But the call in the application files are the right way?
– Thiago Porto
I see no reason to be wrong, normally I would use the css/scss and js/coffee generated by Rails for the same controllers, you call each file directly in html?
– igrossiter
In HTML I only call the application.JS and the application.CSS or I have not changed anything, I left in the same way that Rails created.
– Thiago Porto
The ideal is not to call any file directly, just use the
javascript_include_tag :application
andstylesheet_link_tag :application
and let Rails control which files to add to which pages– igrossiter