0

I am upgrading a theme from Drupal 7 to Drupal 8. I reference .css files in mytheme.library.yml that do not seem to be getting pulled into the site.

I've looked online and even copied sample coding and replace the names appropriately. Yet I do not see them being applied or reference to either .css file, in the source code or Developer Tools.

If these files look correct, then any direction to what could be the cause will be appreciated. If it is permissions, please let me know what permissions it SHOULD be!

I have cleared the cache hundreds of times, after every change, as well as use Incognito Mode so I know it isn't a browser or site caching issue.

Thank you.

Contents of sites/all/themes/mytheme/mytheme.info.yml

name: MyTheme
type: theme
description: My theme.
core: 8.x
base theme: bootstrap
logo: logo.png

regions:

  navigation: 'Navigation'
  header: 'Top Bar'
  highlighted: 'Highlighted'
  help: 'Help'
  content: 'Content'
  sub_content: 'Sub-content'
  sidebar_first: 'Primary'
  sidebar_second: 'Secondary'
  footer: 'Footer'
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  footer_firstcolumn: 'Footer first column'
  footer_secondcolumn: 'Footer second column'

libraries:
  - mytheme/global-assets

Contents of sites/all/themes/mytheme/mytheme.library.yml

global-assets:
  version: VERSION
  css:
    theme:
      css/main.css: {}
      css/bootstrap.css: {}
  js:
    js/main.js: {}
    js/bootstrap.min.js: {}
    js/enquire.min.js: {}
    js/jquery.main.js: {}

Any help or direction would be appreciated.

Thanks

  • 1
    You just have the wrong file name. mytheme.library.yml should be mytheme.libraries.yml – Clive Mar 26 at 18:55
0

Stupid me. I had .library.yml. and now I see it is .libraries.yml. Once I changed it I started getting the styles coming through.

I still have a lot of work to do now to tweak it, but this is a huge step forward.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.