summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Carver2018-02-11 22:10:40 (GMT)
committerMark Carver2018-02-11 22:10:40 (GMT)
commitb4de383544f83d1ee33d082add75527bd2b7e44d (patch)
tree235a5da11fa0b0af5b09738119dbbf4879d47913
parent53ed03b773c5ec37e613c6eb7122af9d3922bd8a (diff)
Issue #2943967 by markcarver: Starterkits don't add framework assets properly
-rw-r--r--bootstrap.libraries.yml10
-rw-r--r--docs/Sub-Theming.md2
-rw-r--r--src/Plugin/Alter/LibraryInfo.php6
-rw-r--r--src/Plugin/Provider/ProviderBase.php1
-rw-r--r--starterkits/cdn/THEMENAME.libraries.yml2
-rw-r--r--starterkits/cdn/THEMENAME.starterkit.yml5
-rw-r--r--starterkits/less/THEMENAME.libraries.yml4
-rw-r--r--starterkits/less/THEMENAME.starterkit.yml6
-rwxr-xr-xstarterkits/sass/THEMENAME.libraries.yml4
-rwxr-xr-xstarterkits/sass/THEMENAME.starterkit.yml6
-rw-r--r--starterkits/sass/css/style.css4
11 files changed, 30 insertions, 20 deletions
diff --git a/bootstrap.libraries.yml b/bootstrap.libraries.yml
index b98efe0..3f87769 100644
--- a/bootstrap.libraries.yml
+++ b/bootstrap.libraries.yml
@@ -5,6 +5,15 @@ attributes:
- core/jquery
- core/underscore
+# This is automatically extended with JavaScript and CSS for CDN based themes.
+# If sub-theme uses a starterkit like LESS or SASS, then it should extend this
+# library to add in the compiled CSS and JavaScript sources.
+framework:
+ css: {}
+ js: {}
+ dependencies:
+ - core/jquery
+
drupal.bootstrap:
js:
js/drupal.bootstrap.js: {}
@@ -12,6 +21,7 @@ drupal.bootstrap:
- core/jquery
- core/drupal
- core/drupalSettings
+ - bootstrap/framework
# Create a library placeholder for livereload.
# This is altered dynamically based on the set URL.
diff --git a/docs/Sub-Theming.md b/docs/Sub-Theming.md
index e408a20..78db638 100644
--- a/docs/Sub-Theming.md
+++ b/docs/Sub-Theming.md
@@ -40,7 +40,7 @@ Once you've selected one of the above starterkits, here's how to install it:
5. Rename `./THEMENAME/THEMENAME.theme`.
6. Open `./THEMENAME/THEMENAME.info.yml` and change the name, description and
any other properties to suite your needs. Make sure to rename the library
- name as well: `- THEMENAME/global-styling`.
+ extension name as well: `THEMENAME/framework`.
7. Rename the sub-theme configuration files, located at:
`./THEMENAME/config/install/THEMENAME.settings.yml` and
`./THEMENAME/config/schema/THEMENAME.schema.yml`.
diff --git a/src/Plugin/Alter/LibraryInfo.php b/src/Plugin/Alter/LibraryInfo.php
index 7665cb9..1c9b105 100644
--- a/src/Plugin/Alter/LibraryInfo.php
+++ b/src/Plugin/Alter/LibraryInfo.php
@@ -47,12 +47,12 @@ class LibraryInfo extends PluginBase implements AlterInterface {
}
// Merge the assets into the library info.
- $libraries['theme'] = NestedArray::mergeDeepArray([$assets, $libraries['theme']], TRUE);
+ $libraries['framework'] = NestedArray::mergeDeepArray([$assets, $libraries['framework']], TRUE);
// Add a specific version and theme CSS overrides file.
// @todo This should be retrieved by the Provider API.
$version = $this->theme->getSetting('cdn_' . $provider->getPluginId() . '_version') ?: Bootstrap::FRAMEWORK_VERSION;
- $libraries['theme']['version'] = $version;
+ $libraries['framework']['version'] = $version;
$provider_theme = $this->theme->getSetting('cdn_' . $provider->getPluginId() . '_theme') ?: 'bootstrap';
$provider_theme = $provider_theme === 'bootstrap' || $provider_theme === 'bootstrap_theme' ? '' : "-$provider_theme";
@@ -68,7 +68,7 @@ class LibraryInfo extends PluginBase implements AlterInterface {
// it isn't added after any potential sub-theme's "theme" category.
// There's no weight, so it will be added after the provider's assets.
// @see https://www.drupal.org/node/2770613
- $libraries['theme']['css']['base'][$overrides] = [];
+ $libraries['framework']['css']['base'][$overrides] = [];
break;
}
}
diff --git a/src/Plugin/Provider/ProviderBase.php b/src/Plugin/Provider/ProviderBase.php
index 9765bb9..c8b3032 100644
--- a/src/Plugin/Provider/ProviderBase.php
+++ b/src/Plugin/Provider/ProviderBase.php
@@ -70,7 +70,6 @@ class ProviderBase extends PluginBase implements ProviderInterface {
$data = [
'data' => $asset,
'type' => 'external',
- 'weight' => -19.999,
];
// CSS library assets use "SMACSS" categorization, assign it to "base".
if ($type === 'css') {
diff --git a/starterkits/cdn/THEMENAME.libraries.yml b/starterkits/cdn/THEMENAME.libraries.yml
index 7e123cd..7ed9b19 100644
--- a/starterkits/cdn/THEMENAME.libraries.yml
+++ b/starterkits/cdn/THEMENAME.libraries.yml
@@ -1,4 +1,4 @@
-global-styling:
+framework:
css:
theme:
css/style.css: {}
diff --git a/starterkits/cdn/THEMENAME.starterkit.yml b/starterkits/cdn/THEMENAME.starterkit.yml
index 1893439..eb00a41 100644
--- a/starterkits/cdn/THEMENAME.starterkit.yml
+++ b/starterkits/cdn/THEMENAME.starterkit.yml
@@ -19,5 +19,6 @@ regions:
page_top: 'Page top'
page_bottom: 'Page bottom'
-libraries:
- - 'THEMENAME/global-styling'
+libraries-extend:
+ bootstrap/framework:
+ - THEMENAME/framework
diff --git a/starterkits/less/THEMENAME.libraries.yml b/starterkits/less/THEMENAME.libraries.yml
index c2a26b9..2a93aa8 100644
--- a/starterkits/less/THEMENAME.libraries.yml
+++ b/starterkits/less/THEMENAME.libraries.yml
@@ -1,9 +1,7 @@
-global-styling:
+framework:
css:
theme:
css/style.css: {}
-
-bootstrap-scripts:
js:
bootstrap/js/affix.js: {}
bootstrap/js/alert.js: {}
diff --git a/starterkits/less/THEMENAME.starterkit.yml b/starterkits/less/THEMENAME.starterkit.yml
index 1ac9670..72fa343 100644
--- a/starterkits/less/THEMENAME.starterkit.yml
+++ b/starterkits/less/THEMENAME.starterkit.yml
@@ -19,6 +19,6 @@ regions:
page_top: 'Page top'
page_bottom: 'Page bottom'
-libraries:
- - 'THEMENAME/global-styling'
- - 'THEMENAME/bootstrap-scripts'
+libraries-extend:
+ bootstrap/framework:
+ - THEMENAME/framework
diff --git a/starterkits/sass/THEMENAME.libraries.yml b/starterkits/sass/THEMENAME.libraries.yml
index c12ea59..169d24f 100755
--- a/starterkits/sass/THEMENAME.libraries.yml
+++ b/starterkits/sass/THEMENAME.libraries.yml
@@ -1,9 +1,7 @@
-global-styling:
+framework:
css:
theme:
css/style.css: {}
-
-bootstrap-scripts:
js:
bootstrap/assets/javascripts/bootstrap/affix.js: {}
bootstrap/assets/javascripts/bootstrap/alert.js: {}
diff --git a/starterkits/sass/THEMENAME.starterkit.yml b/starterkits/sass/THEMENAME.starterkit.yml
index 80f8a90..ab449e0 100755
--- a/starterkits/sass/THEMENAME.starterkit.yml
+++ b/starterkits/sass/THEMENAME.starterkit.yml
@@ -19,6 +19,6 @@ regions:
page_top: 'Page top'
page_bottom: 'Page bottom'
-libraries:
- - 'THEMENAME/global-styling'
- - 'THEMENAME/bootstrap-scripts'
+libraries-extend:
+ bootstrap/framework:
+ - THEMENAME/framework
diff --git a/starterkits/sass/css/style.css b/starterkits/sass/css/style.css
new file mode 100644
index 0000000..4b8181b
--- /dev/null
+++ b/starterkits/sass/css/style.css
@@ -0,0 +1,4 @@
+/**
+ * This file will be overwritten when the Bootstrap Framework source files
+ * are compiled using the SASS CSS pre-processor.
+ */