In Info Veritas's picture

Sorry if this question is stupid again but I'm trying to create a completely blank theme. I want to start from scratch and, for example, I can't get rid of the responsive menu in mobile mode (I want to do it my way).
Is it possible ? Am I wrong and is it smarter to work from basis?
Thanks for your help.
Dominique.

Comments

Starting from a blank theme is fine if you'd like to do it that way. Note that there will still be some core CSS files loaded, but you can override those in your theme so they don't get loaded at all if you prefer.

As far as the responsive menu, you can disable that without removing the core CSS completely as well -- look in the block settings on the Layout in question, and uncheck the option to display "Display menu toggle button on small screens":

To disable in your theme template.php file, add the following hooks.  I'm not sure if these are the correct ones for your use case, but its a good place to start.

/**
 * Implements hook_css_alter().
 */
function custom_theme_css_alter(&$css) {
  unset($css['core/modules/system/css/menu-dropdown.theme.css']);
  unset($css['core/modules/system/css/menu-toggle.theme.css']);
  unset($css['core/misc/smartmenus/css/sm-core-css.css']);
  unset($css['core/modules/system/css/menu-dropdown.theme.breakpoint.css']);
  unset($css['core/modules/system/css/menu-dropdown.theme.breakpoint-queries.css']);
  unset($css['core/misc/normalize.css']);
  unset($css['core/modules/system/css/system.css']);
  unset($css['core/modules/system/css/system.theme.css']);
  unset($css['core/modules/layout/css/grid-flex.css']);
  unset($css[backdrop_get_path('module', 'system') . '/system.messages.css']);
  unset($css[backdrop_get_path('module', 'system') . '/system.theme.css']);
  unset($css[backdrop_get_path('module', 'system') . '/system.menus.css']);
}

/**
 * Implements hook_js_alter().
 */
function custom_theme_js_alter(&$javascript) {
  unset($javascript['core/modules/layout/js/grid-fallback.js']);
  unset($javascript['core/modules/system/js/menus.js']);
  unset($javascript['core/misc/smartmenus/jquery.smartmenus.combined.js']);
  unset($javascript['core/misc/smartmenus/jquery.smartmenus.js']);
  unset($javascript['core/modules/contextual/js/contextual.js']);
}

In Info Veritas's picture

Thank you for your answers. I will try that.

Thanks.

Dominique.

In Info Veritas's picture

For me i modified the .info file of my theme :

; Remove menu CSS
stylesheets[all][] = css/menu-dropdown.theme.css
stylesheets[all][] = css/menu-toggle.theme.css

 

The 2 files are not present in my theme. It's working. Is it the right way ? I don't know but it's working :-)