diff --git a/core/core.library.yml b/core/core.library.yml index 9635123..126e535 100644 --- a/core/core.library.yml +++ b/core/core.library.yml @@ -35,7 +35,7 @@ drupalSettings: drupal.ajax: version: VERSION js: - misc/ajax.js: { weight: 2 } + misc/ajax.js: {} dependencies: - core/jquery - core/drupal @@ -99,7 +99,8 @@ drupal.dialog: misc/dialog.js: {} misc/dialog.position.js: {} css: - misc/dialog.theme.css: { weight: 1 } + theme: + misc/dialog.theme.css: {} dependencies: - core/jquery - core/drupal @@ -111,7 +112,7 @@ drupal.dialog: drupal.dialog.ajax: version: VERSION js: - misc/dialog.ajax.js: { weight: 3 } + misc/dialog.ajax.js: {} dependencies: - core/jquery - core/drupal @@ -133,8 +134,10 @@ drupal.dropbutton: js: misc/dropbutton/dropbutton.js: {} css: - misc/dropbutton/dropbutton.css: {} - misc/dropbutton/dropbutton.theme.css: {} + component: + misc/dropbutton/dropbutton.css: {} + theme: + misc/dropbutton/dropbutton.theme.css: {} dependencies: - core/jquery - core/drupal @@ -144,7 +147,7 @@ drupal.dropbutton: drupal.form: version: VERSION js: - misc/form.js: { weight: 1 } + misc/form.js: {} dependencies: - core/jquery - core/drupal @@ -173,7 +176,7 @@ drupal.progress: drupal.states: version: VERSION js: - misc/states.js: { weight: 1 } + misc/states.js: {} dependencies: - core/jquery - core/drupal @@ -244,7 +247,8 @@ drupal.vertical-tabs: # Load before core/drupal.collapse. misc/vertical-tabs.js: { weight: -1 } css: - misc/vertical-tabs.css: {} + component: + misc/vertical-tabs.css: {} dependencies: - core/jquery - core/drupal @@ -280,7 +284,8 @@ jquery.farbtastic: js: assets/vendor/farbtastic/farbtastic.js: {} css: - assets/vendor/farbtastic/farbtastic.css: {} + component: + assets/vendor/farbtastic/farbtastic.css: {} dependencies: - core/jquery @@ -307,8 +312,10 @@ jquery.ui: js: assets/vendor/jquery.ui/ui/jquery.ui.core.js: { weight: -11 } css: - assets/vendor/jquery.ui/themes/base/jquery.ui.core.css: {} - assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.core.css: {} + theme: + assets/vendor/jquery.ui/themes/base/jquery.ui.theme.css: {} dependencies: - core/jquery @@ -317,7 +324,8 @@ jquery.ui.accordion: js: assets/vendor/jquery.ui/ui/jquery.ui.accordion.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.accordion.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.accordion.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -327,7 +335,8 @@ jquery.ui.autocomplete: js: assets/vendor/jquery.ui/ui/jquery.ui.autocomplete.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.autocomplete.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.autocomplete.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -339,7 +348,8 @@ jquery.ui.button: js: assets/vendor/jquery.ui/ui/jquery.ui.button.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.button.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.button.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -349,7 +359,8 @@ jquery.ui.datepicker: js: assets/vendor/jquery.ui/ui/jquery.ui.datepicker.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.datepicker.css: {} dependencies: - core/jquery.ui @@ -358,7 +369,8 @@ jquery.ui.dialog: js: assets/vendor/jquery.ui/ui/jquery.ui.dialog.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.dialog.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.dialog.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -488,7 +500,8 @@ jquery.ui.menu: js: assets/vendor/jquery.ui/ui/jquery.ui.menu.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.menu.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.menu.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -510,7 +523,8 @@ jquery.ui.progressbar: js: assets/vendor/jquery.ui/ui/jquery.ui.progressbar.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.progressbar.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.progressbar.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -520,7 +534,8 @@ jquery.ui.resizable: js: assets/vendor/jquery.ui/ui/jquery.ui.resizable.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.resizable.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.resizable.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -531,7 +546,8 @@ jquery.ui.selectable: js: assets/vendor/jquery.ui/ui/jquery.ui.selectable.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.selectable.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.selectable.css: {} dependencies: - core/jquery.ui - core/jquery.ui.mouse @@ -542,7 +558,8 @@ jquery.ui.slider: js: assets/vendor/jquery.ui/ui/jquery.ui.slider.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.slider.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.slider.css: {} dependencies: - core/jquery.ui - core/jquery.ui.mouse @@ -571,7 +588,8 @@ jquery.ui.tabs: js: assets/vendor/jquery.ui/ui/jquery.ui.tabs.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.tabs.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.tabs.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -581,7 +599,8 @@ jquery.ui.tooltip: js: assets/vendor/jquery.ui/ui/jquery.ui.tooltip.js: {} css: - assets/vendor/jquery.ui/themes/base/jquery.ui.tooltip.css: {} + component: + assets/vendor/jquery.ui/themes/base/jquery.ui.tooltip.css: {} dependencies: - core/jquery.ui - core/jquery.ui.widget @@ -622,7 +641,8 @@ normalize: remote: https://github.com/necolas/normalize.css version: v2.1.2 css: - assets/vendor/normalize-css/normalize.css: { every_page: true, weight: -220 } + base: + assets/vendor/normalize-css/normalize.css: { every_page: true, weight: -20 } underscore: remote: https://github.com/jashkenas/underscore diff --git a/core/includes/common.inc b/core/includes/common.inc index d05f4fb..0fbbec0 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2806,12 +2806,32 @@ function drupal_get_library($extension, $name = NULL) { } foreach (array('js', 'css') as $type) { + // Prepare (flatten) the SMACSS-categorized definitions. + // @todo After Asset(ic) changes, retain the definitions as-is and + // properly resolve dependencies for all (css) libraries per category, + // and only once prior to rendering out an HTML page. + if ($type == 'css' && !empty($library[$type])) { + foreach ($library[$type] as $category => $files) { + foreach ($files as $source => $options) { + if (!isset($options['weight'])) { + $options['weight'] = 0; + } + // Apply the corresponding weight defined by CSS_* constants. + $options['weight'] += constant('CSS_' . strtoupper($category == 'theme' ? 'skin' : $category)); + $library[$type][$source] = $options; + } + unset($library[$type][$category]); + } + } foreach ($library[$type] as $source => $options) { unset($library[$type][$source]); // Allow to omit the options hashmap in YAML declarations. if (!is_array($options)) { $options = array(); } + if ($type == 'js' && isset($options['weight']) && $options['weight'] > 0) { + throw new \UnexpectedValueException("The $extension/$id library defines a positive weight for '$source'. Only negative weights are allowed (but should be avoided). Instead of a positive weight, specify accurate dependencies for this library."); + } // Unconditionally apply default groups for the defined asset files. // The library system is a dependency management system. Each library // properly specifies its dependencies instead of relying on a custom @@ -2820,7 +2840,7 @@ function drupal_get_library($extension, $name = NULL) { $options['group'] = JS_LIBRARY; } elseif ($type == 'css') { - $options['group'] = $extension_type == 'module' ? CSS_AGGREGATE_DEFAULT : CSS_AGGREGATE_THEME; + $options['group'] = $extension_type == 'theme' ? CSS_AGGREGATE_THEME : CSS_AGGREGATE_DEFAULT; } // By default, all library assets are files. if (!isset($options['type'])) { diff --git a/core/modules/block/block.library.yml b/core/modules/block/block.library.yml index 881a5e9..20a5ce9 100644 --- a/core/modules/block/block.library.yml +++ b/core/modules/block/block.library.yml @@ -11,7 +11,8 @@ drupal.block.admin: js: js/block.admin.js: {} css: - css/block.admin.css: {} + theme: + css/block.admin.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/ckeditor/ckeditor.library.yml b/core/modules/ckeditor/ckeditor.library.yml index fa4d5f2..13a175c 100644 --- a/core/modules/ckeditor/ckeditor.library.yml +++ b/core/modules/ckeditor/ckeditor.library.yml @@ -3,7 +3,8 @@ drupal.ckeditor: js: js/ckeditor.js: {} css: - css/ckeditor.css: {} + state: + css/ckeditor.css: {} dependencies: - core/jquery - core/drupal @@ -15,8 +16,9 @@ drupal.ckeditor.admin: js: js/ckeditor.admin.js: {} css: - css/ckeditor.admin.css: {} - /core/assets/vendor/ckeditor/skins/moono/editor.css: {} + theme: + css/ckeditor.admin.css: {} + /core/assets/vendor/ckeditor/skins/moono/editor.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/config_translation/config_translation.library.yml b/core/modules/config_translation/config_translation.library.yml index 4d8538e..5e31768 100644 --- a/core/modules/config_translation/config_translation.library.yml +++ b/core/modules/config_translation/config_translation.library.yml @@ -1,4 +1,5 @@ drupal.config_translation.admin: version: VERSION css: - css/config_translation.admin.css: {} + theme: + css/config_translation.admin.css: {} diff --git a/core/modules/content_translation/content_translation.library.yml b/core/modules/content_translation/content_translation.library.yml index b7c6d47..3dd1ce0 100644 --- a/core/modules/content_translation/content_translation.library.yml +++ b/core/modules/content_translation/content_translation.library.yml @@ -3,7 +3,8 @@ drupal.content_translation.admin: js: content_translation.admin.js: {} css: - css/content_translation.admin.css: {} + theme: + css/content_translation.admin.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/contextual/contextual.library.yml b/core/modules/contextual/contextual.library.yml index f098617..05b2f1a 100644 --- a/core/modules/contextual/contextual.library.yml +++ b/core/modules/contextual/contextual.library.yml @@ -12,9 +12,11 @@ drupal.contextual-links: js/views/RegionView.js: { weight: -2 } js/views/VisualView.js: { weight: -2 } css: - css/contextual.module.css: {} - css/contextual.theme.css: {} - css/contextual.icons.css: {} + component: + css/contextual.module.css: {} + theme: + css/contextual.theme.css: {} + css/contextual.icons.css: {} dependencies: - core/jquery - core/drupal @@ -28,7 +30,8 @@ drupal.contextual-toolbar: js: js/contextual.toolbar.js: {} css: - css/contextual.toolbar.css: {} + component: + css/contextual.toolbar.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/edit/edit.library.yml b/core/modules/edit/edit.library.yml index d80cd0b..053eeb0 100644 --- a/core/modules/edit/edit.library.yml +++ b/core/modules/edit/edit.library.yml @@ -21,9 +21,11 @@ edit: # Other. js/theme.js: { scope: footer } css: - css/edit.module.css: {} - css/edit.theme.css: {} - css/edit.icons.css: {} + component: + css/edit.module.css: {} + theme: + css/edit.theme.css: {} + css/edit.icons.css: {} dependencies: - core/jquery - core/underscore diff --git a/core/modules/editor/editor.library.yml b/core/modules/editor/editor.library.yml index 142ce39..2504458 100644 --- a/core/modules/editor/editor.library.yml +++ b/core/modules/editor/editor.library.yml @@ -11,7 +11,8 @@ drupal.editor: js: js/editor.js: {} css: - css/editor.css: {} + component: + css/editor.css: {} dependencies: - core/jquery - core/drupal @@ -21,7 +22,7 @@ drupal.editor: drupal.editor.dialog: version: VERSION js: - js/editor.dialog.js: { weight: 2 } + js/editor.dialog.js: {} dependencies: - core/jquery - core/drupal.dialog diff --git a/core/modules/field_ui/field_ui.library.yml b/core/modules/field_ui/field_ui.library.yml index 5cb861a..4add558 100644 --- a/core/modules/field_ui/field_ui.library.yml +++ b/core/modules/field_ui/field_ui.library.yml @@ -3,7 +3,8 @@ drupal.field_ui: js: field_ui.js: {} css: - css/field_ui.admin.css: {} + theme: + css/field_ui.admin.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/file/file.library.yml b/core/modules/file/file.library.yml index fe4d9ad..1cb5e06 100644 --- a/core/modules/file/file.library.yml +++ b/core/modules/file/file.library.yml @@ -3,7 +3,8 @@ drupal.file: js: file.js: {} css: - css/file.admin.css: {} + theme: + css/file.admin.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/filter/filter.library.yml b/core/modules/filter/filter.library.yml index c2bb8ae..91aea0b 100644 --- a/core/modules/filter/filter.library.yml +++ b/core/modules/filter/filter.library.yml @@ -3,7 +3,8 @@ drupal.filter.admin: js: filter.admin.js: {} css: - css/filter.admin.css: {} + theme: + css/filter.admin.css: {} dependencies: - core/jquery - core/drupal @@ -24,7 +25,9 @@ drupal.filter: js: filter.js: {} css: - css/filter.admin.css: {} + theme: + # @todo Misnomer: Does not contain administrative styles. + css/filter.admin.css: {} dependencies: - core/jquery - core/drupal @@ -33,4 +36,5 @@ drupal.filter: caption: version: VERSION css: - css/filter.caption.css: {} + component: + css/filter.caption.css: {} diff --git a/core/modules/forum/forum.library.yml b/core/modules/forum/forum.library.yml index 1a1f547..28ceda3 100644 --- a/core/modules/forum/forum.library.yml +++ b/core/modules/forum/forum.library.yml @@ -1,4 +1,5 @@ forum.index: version: VERSION css: - css/forum.module.css: {} + component: + css/forum.module.css: {} diff --git a/core/modules/shortcut/shortcut.library.yml b/core/modules/shortcut/shortcut.library.yml index d0aac1a..94bad9d 100644 --- a/core/modules/shortcut/shortcut.library.yml +++ b/core/modules/shortcut/shortcut.library.yml @@ -9,6 +9,8 @@ drupal.shortcut.admin: drupal.shortcut: version: VERSION css: - css/shortcut.module.css: {} - css/shortcut.theme.css: {} - css/shortcut.icons.css: {} + component: + css/shortcut.module.css: {} + theme: + css/shortcut.theme.css: {} + css/shortcut.icons.css: {} diff --git a/core/modules/simpletest/simpletest.library.yml b/core/modules/simpletest/simpletest.library.yml index ef6b53c..7bcbc07 100644 --- a/core/modules/simpletest/simpletest.library.yml +++ b/core/modules/simpletest/simpletest.library.yml @@ -3,7 +3,8 @@ drupal.simpletest: js: simpletest.js: {} css: - css/simpletest.module.css: {} + component: + css/simpletest.module.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/system/system.library.yml b/core/modules/system/system.library.yml index 90c67d1..61eb1b4 100644 --- a/core/modules/system/system.library.yml +++ b/core/modules/system/system.library.yml @@ -2,22 +2,26 @@ base: version: VERSION css: # Adjust the weights to load these early. - css/system.module.css: { every_page: true, weight: -10, } - css/system.theme.css: { every_page: true, weight: 190 } + component: + css/system.module.css: { every_page: true, weight: -10, } + theme: + css/system.theme.css: { every_page: true, weight: -10 } dependencies: - core/normalize admin: version: VERSION css: - css/system.admin.css: { weight: -10 } + theme: + css/system.admin.css: { weight: -10 } dependencies: - system/base maintenance: version: VERSION css: - css/system.maintenance.css: { weight: -10 } + theme: + css/system.maintenance.css: { weight: -10 } dependencies: - system/base - system/admin diff --git a/core/modules/system/tests/modules/common_test/common_test.library.yml b/core/modules/system/tests/modules/common_test/common_test.library.yml index 77282a2..47d2b37 100644 --- a/core/modules/system/tests/modules/common_test/common_test.library.yml +++ b/core/modules/system/tests/modules/common_test/common_test.library.yml @@ -3,6 +3,7 @@ jquery.farbtastic: js: assets/vendor/farbtastic/farbtastic.js: {} css: - assets/vendor/farbtastic/farbtastic.css: {} + component: + assets/vendor/farbtastic/farbtastic.css: {} dependencies: - core/jquery diff --git a/core/modules/taxonomy/taxonomy.library.yml b/core/modules/taxonomy/taxonomy.library.yml index 41193d9..7d6f50d 100644 --- a/core/modules/taxonomy/taxonomy.library.yml +++ b/core/modules/taxonomy/taxonomy.library.yml @@ -3,7 +3,8 @@ drupal.taxonomy: js: taxonomy.js: {} css: - css/taxonomy.module.css: {} + component: + css/taxonomy.module.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/toolbar/toolbar.library.yml b/core/modules/toolbar/toolbar.library.yml index d658457..d58522e 100644 --- a/core/modules/toolbar/toolbar.library.yml +++ b/core/modules/toolbar/toolbar.library.yml @@ -12,9 +12,11 @@ toolbar: js/views/ToolbarAuralView.js: {} js/views/ToolbarVisualView.js: {} css: - css/toolbar.module.css: {} - css/toolbar.theme.css: {} - css/toolbar.icons.css: {} + component: + css/toolbar.module.css: {} + theme: + css/toolbar.theme.css: {} + css/toolbar.icons.css: {} dependencies: - core/modernizr - core/jquery @@ -32,7 +34,8 @@ toolbar.menu: js: js/toolbar.menu.js: {} css: - css/toolbar.menu.css: {} + state: + css/toolbar.menu.css: {} dependencies: - core/jquery - core/drupal diff --git a/core/modules/tour/tour.library.yml b/core/modules/tour/tour.library.yml index 8077931..92dd861 100644 --- a/core/modules/tour/tour.library.yml +++ b/core/modules/tour/tour.library.yml @@ -12,7 +12,8 @@ tour: tour-styling: version: VERSION css: - css/tour.module.css: { media: screen } + component: + css/tour.module.css: { media: screen } # @todo Move into /core/assets and core.library.yml. jquery.joyride: @@ -21,7 +22,8 @@ jquery.joyride: js: js/jquery.joyride-2.0.3.js: {} css: - css/joyride-2.0.3.css: { media: screen } + component: + css/joyride-2.0.3.css: { media: screen } dependencies: - core/jquery - core/jquery.cookie diff --git a/core/modules/update/update.library.yml b/core/modules/update/update.library.yml index a29c180..0661acc 100644 --- a/core/modules/update/update.library.yml +++ b/core/modules/update/update.library.yml @@ -1,4 +1,5 @@ drupal.update.admin: version: VERSION css: - css/update.admin.css: {} + theme: + css/update.admin.css: {} diff --git a/core/modules/user/user.library.yml b/core/modules/user/user.library.yml index 9bcfdff..b5458d0 100644 --- a/core/modules/user/user.library.yml +++ b/core/modules/user/user.library.yml @@ -3,7 +3,8 @@ drupal.user: js: user.js: {} css: - css/user.module.css: {} + component: + css/user.module.css: {} dependencies: - core/jquery - core/drupal @@ -21,4 +22,5 @@ drupal.user.permissions: drupal.user.icons: version: VERSION css: - css/user.icons.css: {} + theme: + css/user.icons.css: {} diff --git a/core/modules/views/views.library.yml b/core/modules/views/views.library.yml index fe5f75d..d9111bb 100644 --- a/core/modules/views/views.library.yml +++ b/core/modules/views/views.library.yml @@ -1,7 +1,8 @@ views.module: version: VERSION css: - css/views.module.css: {} + component: + css/views.module.css: {} views.ajax: version: VERSION @@ -28,4 +29,5 @@ views.contextual-links: views.exposed-form: version: VERSION css: - css/views.exposed_form.css: {} + component: + css/views.exposed_form.css: {} diff --git a/core/themes/bartik/bartik.library.yml b/core/themes/bartik/bartik.library.yml index 71f85d4..c864016 100644 --- a/core/themes/bartik/bartik.library.yml +++ b/core/themes/bartik/bartik.library.yml @@ -1,6 +1,7 @@ maintenance_page: version: VERSION css: - css/maintenance-page.css: {} + theme: + css/maintenance-page.css: {} dependencies: - system/maintenance diff --git a/core/themes/seven/seven.library.yml b/core/themes/seven/seven.library.yml index fd01adc..b7c66d4 100644 --- a/core/themes/seven/seven.library.yml +++ b/core/themes/seven/seven.library.yml @@ -3,6 +3,7 @@ install-page: js: js/mobile.install.js: {} css: - install-page.css: {} + theme: + install-page.css: {} dependencies: - system/maintenance