- Doc officielle CSS : function drupal_add_css
- Doc officielle JS :
Voir notamment au niveau de la méthode path_to_theme()
et de l’option group pour choisir l’ordre de chargement des fichiers.
1 2 3 4 5 6 |
function <my_theme>_preprocess_page(&$variables) { // On the front page, add another CSS file to the CSS_THEME group if ($variables['is_front'] == TRUE) { drupal_add_css(path_to_theme(). '/css/front.css', array('group' => CSS_THEME)); } } |
On peut également affiner la position de chargement de la CSS avec l’option weight :
1 2 3 4 5 6 |
function <my_theme>_preprocess_page(&$variables) { // On the front page, add another CSS file if ($variables['is_front'] == TRUE) { drupal_add_css(path_to_theme(). '/css/front.css', array('group' => CSS_THEME, 'weight' => -10)); } } |