Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CDN CLF libraries to hook_library_info_build() #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 0 additions & 135 deletions galactus.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,141 +75,6 @@ global:
dependencies:
- core/jquery

### CDN CLF Versions ###
cdn-clf-js:
version: 7.0.4
js:
https://cdn.ubc.ca/clf/7.0.4/js/ubc-clf.min.js: {}
dependencies:
- core/jquery

# Full-width, White on Blue
clf-cdn-fw-wb:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full.min.css: { type: external }
dependencies:
- galactus/cdn-clf-js

# Full-width, Blue on White
clf-cdn-fw-bw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-bw.min.css: { type: external }
dependencies:
- galactus/cdn-clf-js

# Full-width, White on Grey
clf-cdn-fw-wg:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-wg.min.css: { type: external }
dependencies:
- galactus/cdn-clf-js

# Full-width, Grey on White
clf-cdn-fw-gw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-gw.min.css: { type: external }
dependencies:
- galactus/cdn-clf-js

### Minimal CLF Versions ###

# Full-width, White on Blue
clf-fw-wb:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js


# Full-width, Blue on White
clf-fw-bw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-bw.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Full-width, White on Grey
clf-fw-wg:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-wg.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Full-width, Grey on White
clf-fw-gw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-gw.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Standard-width, White on Blue
clf-sw-wb:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Standard-width, Blue on White
clf-sw-bw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-bw.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Standard-width, White on Grey
clf-sw-wg:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-wg.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Standard-width, Grey on White
clf-sw-gw:
version: 7.0.4
css:
base:
https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-gw.css: { type: external }
theme:
css/clf.social-icons.css: {}
dependencies:
- galactus/cdn-clf-js

# Local Version of CLF (all variants)
clf-local:
version: 7.0.4
Expand Down
64 changes: 64 additions & 0 deletions galactus.theme
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,67 @@ function galactus_preprocess_fieldset(&$variables) {
}
}
}

/**
* Implements hook_library_info_build().
*/
function galactus_library_info_build() {
$libraries = [];

$library_definitions = [
# Full-width, White on Blue.
'clf-cdn-fw-wb' => 'https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full.min.css',
# Full-width, Blue on White.
'clf-cdn-fw-bw' => 'https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-bw.min.css',
# Full-width, Grey on White.
'clf-cdn-fw-wg' => 'https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-wg.min.css',
# Full-width, White on Grey.
'clf-cdn-fw-gw' => 'https://cdn.ubc.ca/clf/7.0.4/css/ubc-clf-full-gw.min.css',

### Minimal CLF Versions ###

# Full-width, White on Blue.
'clf-fw-wb' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4.css',
# Full-width, Blue on White.
'clf-fw-bw' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-bw.css',
# Full-width, White on Grey.
'clf-fw-wg' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-wg.css',
# Full-width, Grey on White.
'clf-fw-gw' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-full-7.0.4-gw.css',

// Standard-width Minimal CLF.
# Standard-width, White on Blue.
'clf-sw-wb' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4.css',
# Standard-width, Blue on White.
'clf-sw-bw' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-bw.css',
# Standard-width, White on Grey.
'clf-sw-wg' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-wg.css',
# Standard-width, Grey on White.
'clf-sw-gw' => 'https://cdn.ubc.ca/clf/7.0.4-minimal/css/minimal-clf-7.0.4-gw.css',
];

// Build the libraries array
foreach ($library_definitions as $name => $file) {
$libraries[$name] = [
'version' => '7.0.4',
'css' => ['base' => [$file => ['type' => 'external']]],
'dependencies' => ['galactus/cdn-clf-js'],
];

// Add social icons only for minimal libraries.
if (str_contains($file, 'minimal')) {
$libraries[$name]['css']['theme'] = [
'css/clf.social-icons.css' => [],
];
}
}

// Common JS.
$libraries['cdn-clf-js'] = [
'version' => '7.0.4',
'js' => ['https://cdn.ubc.ca/clf/7.0.4/js/ubc-clf.min.js' => []],
'dependencies' => ['core/jquery'],
];

return $libraries;
}