Should I put .js in front of .css, or .css in front of .js files? Which is better? I’m working on a html5 project with jquery.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no better way. As long as they are all in the header there is no difference in their order unless they depend on each other.
EDIT: The above is true in most simple cases.
Ideally, you should put all of your CSS styles in the
HEADelement and all of yourSCRIPTelements in the order of dependence at the end of theBODYelement (directly before the ending</body>).Different orders can make some difference in newer desktop browsers. In mobile browsers, speculative parsing is not available, so the browser waits for requests of scripts before any other loading is performed.
tl;dr – It doesn’t really matter as the differences are trivial, especially if your frontend has heavy JavaScript dependence.