I'm a drupal newbie...
When I define css and js at filename.info file, it takes effects for all pages. I have some particular css-js files for some particular pages, and I don't wanna slow site down by importing all these files for the pages actually no need these files.
How can I define js and css for particular pages?
Appreciate helps!!! thanks a lot!!!
You can always add specific JavaScript for a particular content type using the preprocess_node function in template.php of your theme:-
Similarly using drupal_add_css for stylesheets.
The Drupal API offers two functions
drupal_add_css
anddrupal_add_js
that you can use.There's a gotcha, if you use these in fx the
preprocess_page
function where the$script
and$styles
variable already has been created, you need to overwrite it with,drupal_get_css
ordrupal_get_js