diff --git a/modules/browser_development_assist/browser_development_assist.module b/modules/browser_development_assist/browser_development_assist.module index 5a1245172cf66a75de8eef61822a1d708eab64a9..829ae3a071eb1cf162849179afbf16acf9bfc3dc 100644 --- a/modules/browser_development_assist/browser_development_assist.module +++ b/modules/browser_development_assist/browser_development_assist.module @@ -7,6 +7,7 @@ use Drupal\browser_development_assist\Processing\FileSystemStructure; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Asset\AttachedAssetsInterface; /** * Implements hook_help(). @@ -27,20 +28,6 @@ function browser_development_assist_help($route_name, RouteMatchInterface $route } } -/** - * Implements hook_page_attachments(). - */ -function browser_development_assist_page_attachments(array &$page) { - - // Attaching library to theme - $active = \Drupal::theme()->getActiveTheme()->getName(); - $current_theme = \Drupal::config('system.theme')->get('default'); - if ($active === $current_theme) { - $page['#attached']['library'][] = 'browser_development_assist/browser-development-assist'; - } -} - - /** * Implements hook_library_info_build(). */ @@ -53,10 +40,43 @@ function browser_development_assist_library_info_build() { 'version' => 'VERSION', 'css' => [ 'theme' => [ - "$css" => ['weight' => '100'] + "$css" => [] ] ], ], ]; } +/** + * Attaches + * + * Implements hook_page_attachments(). + */ +function browser_development_assist_page_attachments(array &$page) { + + // Attaching library to theme + $active = \Drupal::theme()->getActiveTheme()->getName(); + $current_theme = \Drupal::config('system.theme')->get('default'); + if ($active === $current_theme) { + $page['#attached']['library'][] = 'browser_development_assist/browser-development-assist'; + } +} + + + + + +/** + * Implements hook_css_alter(). + */ +function browser_development_assist_css_alter(&$css, AttachedAssetsInterface $assets) { + + $library = \Drupal::service('library.discovery') + ->getLibraryByName('browser_development_assist', 'browser-development-assist'); + + $path = $library['css'][0]['data']; + + if (isset($css[$path])) { + $css[$path]['group'] = 300; + } +}