Skip to content

Commit b4de383

Browse files
committed
Issue #2943967 by markcarver: Starterkits don't add framework assets properly
1 parent 53ed03b commit b4de383

11 files changed

+30
-20
lines changed

bootstrap.libraries.yml

+10
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ attributes:
55
- core/jquery
66
- core/underscore
77

8+
# This is automatically extended with JavaScript and CSS for CDN based themes.
9+
# If sub-theme uses a starterkit like LESS or SASS, then it should extend this
10+
# library to add in the compiled CSS and JavaScript sources.
11+
framework:
12+
css: {}
13+
js: {}
14+
dependencies:
15+
- core/jquery
16+
817
drupal.bootstrap:
918
js:
1019
js/drupal.bootstrap.js: {}
1120
dependencies:
1221
- core/jquery
1322
- core/drupal
1423
- core/drupalSettings
24+
- bootstrap/framework
1525

1626
# Create a library placeholder for livereload.
1727
# This is altered dynamically based on the set URL.

docs/Sub-Theming.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Once you've selected one of the above starterkits, here's how to install it:
4040
5. Rename `./THEMENAME/THEMENAME.theme`.
4141
6. Open `./THEMENAME/THEMENAME.info.yml` and change the name, description and
4242
any other properties to suite your needs. Make sure to rename the library
43-
name as well: `- THEMENAME/global-styling`.
43+
extension name as well: `THEMENAME/framework`.
4444
7. Rename the sub-theme configuration files, located at:
4545
`./THEMENAME/config/install/THEMENAME.settings.yml` and
4646
`./THEMENAME/config/schema/THEMENAME.schema.yml`.

src/Plugin/Alter/LibraryInfo.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function alter(&$libraries, &$extension = NULL, &$context2 = NULL) {
4747
}
4848

4949
// Merge the assets into the library info.
50-
$libraries['theme'] = NestedArray::mergeDeepArray([$assets, $libraries['theme']], TRUE);
50+
$libraries['framework'] = NestedArray::mergeDeepArray([$assets, $libraries['framework']], TRUE);
5151

5252
// Add a specific version and theme CSS overrides file.
5353
// @todo This should be retrieved by the Provider API.
5454
$version = $this->theme->getSetting('cdn_' . $provider->getPluginId() . '_version') ?: Bootstrap::FRAMEWORK_VERSION;
55-
$libraries['theme']['version'] = $version;
55+
$libraries['framework']['version'] = $version;
5656
$provider_theme = $this->theme->getSetting('cdn_' . $provider->getPluginId() . '_theme') ?: 'bootstrap';
5757
$provider_theme = $provider_theme === 'bootstrap' || $provider_theme === 'bootstrap_theme' ? '' : "-$provider_theme";
5858

@@ -68,7 +68,7 @@ public function alter(&$libraries, &$extension = NULL, &$context2 = NULL) {
6868
// it isn't added after any potential sub-theme's "theme" category.
6969
// There's no weight, so it will be added after the provider's assets.
7070
// @see https://www.drupal.org/node/2770613
71-
$libraries['theme']['css']['base'][$overrides] = [];
71+
$libraries['framework']['css']['base'][$overrides] = [];
7272
break;
7373
}
7474
}

src/Plugin/Provider/ProviderBase.php

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public function getAssets($types = NULL) {
7070
$data = [
7171
'data' => $asset,
7272
'type' => 'external',
73-
'weight' => -19.999,
7473
];
7574
// CSS library assets use "SMACSS" categorization, assign it to "base".
7675
if ($type === 'css') {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
global-styling:
1+
framework:
22
css:
33
theme:
44
css/style.css: {}

starterkits/cdn/THEMENAME.starterkit.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ regions:
1919
page_top: 'Page top'
2020
page_bottom: 'Page bottom'
2121

22-
libraries:
23-
- 'THEMENAME/global-styling'
22+
libraries-extend:
23+
bootstrap/framework:
24+
- THEMENAME/framework

starterkits/less/THEMENAME.libraries.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
global-styling:
1+
framework:
22
css:
33
theme:
44
css/style.css: {}
5-
6-
bootstrap-scripts:
75
js:
86
bootstrap/js/affix.js: {}
97
bootstrap/js/alert.js: {}

starterkits/less/THEMENAME.starterkit.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ regions:
1919
page_top: 'Page top'
2020
page_bottom: 'Page bottom'
2121

22-
libraries:
23-
- 'THEMENAME/global-styling'
24-
- 'THEMENAME/bootstrap-scripts'
22+
libraries-extend:
23+
bootstrap/framework:
24+
- THEMENAME/framework

starterkits/sass/THEMENAME.libraries.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
global-styling:
1+
framework:
22
css:
33
theme:
44
css/style.css: {}
5-
6-
bootstrap-scripts:
75
js:
86
bootstrap/assets/javascripts/bootstrap/affix.js: {}
97
bootstrap/assets/javascripts/bootstrap/alert.js: {}

starterkits/sass/THEMENAME.starterkit.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ regions:
1919
page_top: 'Page top'
2020
page_bottom: 'Page bottom'
2121

22-
libraries:
23-
- 'THEMENAME/global-styling'
24-
- 'THEMENAME/bootstrap-scripts'
22+
libraries-extend:
23+
bootstrap/framework:
24+
- THEMENAME/framework

starterkits/sass/css/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* This file will be overwritten when the Bootstrap Framework source files
3+
* are compiled using the SASS CSS pre-processor.
4+
*/

0 commit comments

Comments
 (0)