Problem/Motivation

The Bulmaswath project provides custom themes for Bulma.

Proposed resolution

  • Add a section to the theme settings to allow selection of a Bulmaswatch theme. If the Bulmaswatch files are not present in the libraries directory, give a message and a download link. Otherwise, present a select for the desired theme. When a given theme is selected, provide a preview link.
  • If a custom Bulmaswatch theme is selected, alter the library info to swap in that theme's compiled CSS.
  • Tweak page template HTML and classes added to nav menu block to more closely match that expected for Bulmaswatch themes. This resolves display issues.
  • Add support to the default starterkit theme.
  • Introduce CDN support. Default to CDN, but if the local version is in libraries/bulmaswatch that is used instead.

Remaining tasks

  • It's heavy handed to do a full drupal_flush_all_caches() when the selected Bulmaswatch theme is changed. Can we instead invalidate specific caches?
  • Should we do a live preview when a user selects a theme? The Bulmaswatch API json provides a 'thumb' URL, but this is an HTML page rather than an image. Example: https://jenil.github.io/bulmaswatch/thumb/?cerulean. We could use an iframe.
  • Ideally we would not be adding a hook implementation (hook_library_info_alter()) to both the base theme and the starterkit. This is needed at present because by default the subtheme is overriding/replacing the bulma/global library. If that changes in #2902353: Implement CDN, we could remove this hook duplication.

User interface changes

API changes

Data model changes

Comments

nedjo created an issue. See original summary.

nedjo’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new5.22 KB
nedjo’s picture

Issue summary: View changes
StatusFileSize
new8.6 KB
new3.48 KB

Changes since previous patch:

  • Tweak page template HTML and classes added to nav menu block to more closely match that expected for Bulmaswatch themes. This resolves display issues.
  • Add is-clipped class to the nav-left element to resolve the issue that, due to the site name text dimensions, the element had overflow in certain Bulmaswatch themes.
nedjo’s picture

Issue summary: View changes
StatusFileSize
new9.28 KB
new2.99 KB

Changes since the previous patch:

  • If the Bulmaswatch files are not present in the libraries directory, give a message and a download link on the theme settings form.
  • Add a preview link for each theme. Use #states to display only if the given theme is selected.
nedjo’s picture

Issue summary: View changes
StatusFileSize
new18.85 KB
new10.7 KB

Changes since the previous version:

  • Update the default starterkit theme to add support for Bulmaswatch theme selection. Includes unrelated updates to the starterkit page template.
  • Rework processing of main menu block to use a theme-independent selector so as to work on subthemes.
valic’s picture

Assigned: Unassigned » valic
nedjo’s picture

Related issues: +#2902353: Implement CDN

Related: #2902353: Implement CDN.

The Bulmaswatch API file https://github.com/jenil/bulmaswatch/blob/gh-pages/api/themes.json includes a 'css' URL for each theme.

I generally prefer to host files locally but it would be easy to add this as an option. Hmm, it would require some refactoring, in that we wouldn't read available themes from a local file. Maybe: default to the remote files, but downloading the library triggers use of the local version.

nedjo’s picture

Issue summary: View changes

Noting some outstanding questions in the issue summary "Remaining tasks" section.

nedjo’s picture

Issue summary: View changes
Status: Needs review » Fixed

The basic work is now committed, though the commit is not showing up here yet. This was a big set of changes and follow-up work will be needed, but we can close this and do the followup in new issues.

  • nedjo committed 6dedcc6 on 8.x-1.x
    Issue #2901948 by nedjo: Fix location of *.cdn.yml file in default...

  • nedjo committed 7c69926 on 8.x-1.x
    Issue #2901948 by nedjo: Adjust page template for better bulmaswatch...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.