Drupal 8 - Theme building tips.
To remove existing css from the theme. (eg : css from core)
In THEME_NAME_info.yml
Add some JS / CSS only for front-page :
First create a new library in your THEME_NAME_library.yml
Then add that library to page through a pre-processor (THEME_NAME.theme) :
The Home page should have the required `bx-slider.js` now.
More tips coming up...
In THEME_NAME_info.yml
stylesheets-remove : - core/modules/system/css/system.module.css - core/modules/views/css/views.module.css
Add some JS / CSS only for front-page :
First create a new library in your THEME_NAME_library.yml
front-page-library: js: - js/bx-slider.js
Then add that library to page through a pre-processor (THEME_NAME.theme) :
<?php function THEME_NAME_preprocess_page(&$variables) { if ($variables['is_front']) { $variables['#attached']['library'][] = 'THEME_NAME/front-page-library'; } }
The Home page should have the required `bx-slider.js` now.
More tips coming up...
Comments