I'm having trouble with a LESS sub-theme, which appears to be related to CDN Provider configuration (but not like #2630670: custom style.css not loading).

Steps to reproduce:

  1. checked out bootstrap Drupal theme 8.x-3.x-dev
  2. copied less starterkit sub-theme to mytheme in sites/default/themes/mytheme and changed all the STARTERKIT references, including in mytheme.libraries.yml
  3. checked out bootstrap source files in ./mytheme/bootstrap
  4. compiled lessc ./mytheme/less/style.less ./mytheme/css/style.css
  5. drush cr
  6. enabled mytheme
  7. visit homepage and see no styling ... no mytheme css or js assets
  8. enable CDN (jsdeliver) in mytheme settings ... bam! bootstrap assets show up, from CDN, but of course not from local mytheme assets...

So I did some php debugging and came across the alter that runs if a provider is found with assets, where no alteration of library info should happen in the case where no CDN provider is selected/configured. Still can't quite understand how the sub-theme's libraries / assets aren't being loaded... I'll keep debugging, but in the meantime; can you reproduce this, Mark?

Comments

steveoliver created an issue. See original summary.

steveoliver’s picture

If you're debugging PHP, notice that $definition on line 59 of core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php is false when $extension is mytheme, but not when $extension is bootstrap or any other value.

Debugging continues...

steveoliver’s picture

Assigned: Unassigned » steveoliver

...and everything works as expected if I remove the ./config directory from the sub-theme... (will search other core issues around theme ./config/install)...

steveoliver’s picture

Title: Cannot sub-theme with LESS starterkit » Theme config install settings.yml file breaks Bootstrap sub-theme
Assigned: steveoliver » Unassigned
Status: Active » Needs review

I see nothing in Drupal core issues (not that it's not there!), and after re-testing a few times locally, making absolutely sure all THEMENAME strings are replaced with mytheme, it seems the issue is with the ./config/install/mytheme.settings.yml --- If this file is removed, everything works as expected.

Unassigning myself for now and moving on with my sub-theme. I think this issue could use another review from someone more familiar with the config/install functionality in Drupal core.

blainelang’s picture

I was having the very same issue @steve and then found that I had not changed the libraries definition in the {subtheme}.info.ym file

libraries:
- 'THEMENAME/global-styling'
- 'THEMENAME/bootstrap-scripts'

Changing that and now my sub theme is picking up the compiled style.css file in the subtheme/css directory.

markhalliwell’s picture

Status: Needs review » Active

No patch.

ultimike’s picture

A project I'm working with got bit by this issue as well. Our lack of updating these filenames (using the LESS starter kit) resulted in (as crazy as it sounds) dropdown menus not working.

Once we renamed the two ./subtheme/config/... files, we uninstalled and reinstalled the subtheme, cleared all caches, and the dropdown menus worked fine.

This really, really needs to be added to the documentation. In addition, the renaming of the THEMENAME.libraries.yml and THEMENAME.theme files aren't mentioned. I suggest inserting some new steps on http://drupal-bootstrap.org/api/bootstrap/docs%21subtheme%21README.md/gr... - perhaps they could read like this:

Once you've selected one of the above starterkits, here's how to install it:

  1. Copy over one of the starterkits you have chosen from the ./bootstrap/starterkits directory into the themes directory.
  2. Rename the folder to a unique machine readable name. This will be your sub-theme's "name". For this example and future examples we'll use subtheme.
  3. Rename ./subtheme/THEMENAME.starterkit.yml to match the folder name and append .info.yml (e.g. ./subtheme/subtheme.info.yml).
  4. Rename ./subtheme/THEMENAME.libraries.yml to match the folder name (e.g. ./subtheme/subtheme.libraries.yml).
  5. Rename ./subtheme/THEMENAME.theme to match the folder name (e.g. ./subtheme/subtheme.theme).
  6. Rename ./subtheme/config/install/THEMENAME.settings.yml to match the folder name (e.g. ./subtheme/config/install/subtheme.settings.yml).
  7. Rename ./subtheme/config/schema/THEMENAME.schema.yml to match the folder name (e.g. ./subtheme/config/schema/subtheme.schema.yml).
  8. Open ./subtheme/subtheme.info.yml and change the name, description and any other properties to suite your needs. Be sure to also change - THEMENAME/globalstyling to - subtheme/globalstyling.

thanks,
-mike

danjordan’s picture

Thank you @ultimike. Was having a different issue with my LESS sub theme. Forms would not display. Followed your steps, renamed the two config files, uninstalled and reinstalled the theme and cleared the cache and all fixed.

Updating the documentation is a great idea.

thursday_bw’s picture

Rename ./subtheme/THEMENAME.libraries.yml to match the folder name and append .info.yml (e.g. ./subtheme/subtheme.libraries.yml).

Shouldn't that be "(e.g. ./subtheme/subtheme.info.yml) ?

thursday_bw’s picture

oh.. no,, you just need to remove "and append .info.yml" from step 4.. maybe.

ultimike’s picture

@thursday_bw - good catch - I've just updated the suggested help text in comment 7 above.

thanks,
-mike

jorgediazhav’s picture

Status: Active » Closed (duplicate)

This was already fixed on this issue: https://www.drupal.org/node/2689693

tarun8085’s picture

I have tried the below solution and it worked out for me for single item import.

Try to run this query in your database :

SELECT * FROM `config` WHERE `name` LIKE '%THEMENAME.settings%';

If there is a row found, delete that row from config table.
Clear cache once and it should not give you the THEMENAME.settings error any more during single item import.

ezra’s picture

#13 worked for me. In case anyone doesn't know SQL, after you get a response from the Select statement above, run the following query:

DELETE FROM `config` WHERE `name` LIKE '%THEMENAME.settings%';

jakubmroz’s picture

To be precise, that should work in most cases:

DELETE FROM `config` WHERE `name` LIKE '%THEME_NAME%';

where THEME_NAME is the old theme that's is causing issues.

soumyapsadanandan’s picture

#13 worked for me.

dadderley’s picture

Component: Starterkit (LESS) » Code

#13 worked for me too. Thanks

drupalfan2’s picture

#13 & #14 worked for me. Thanks.