2

For some reason my theme can't find css/style.css in Drupal 8.

This is the .info.yml:

name: Adminimal
type: theme
description: Drupal Administration Simplified.
# version: VERSION
# core: 8.x
base theme: seven

# Include CSS.
 stylesheets:
  all:
   - css/style.css

# Information added by Drupal.org packaging script on 2014-10-23
version: '8.x-1.x-dev'
core: '8.x'
project: 'adminimal_theme'
datestamp: 1414059738

This is how the folders look like:

Theme/adminimal.info.yml
Theme/css/style.css

The css in the style.css file:

html{
    background-color: blue !important;
}

It doesn't even show up in the styles section in my Google Chrome console so I think it doesn't find the file but why?

And about jQuery in Drupal, I can't manage to get this working: https://www.drupal.org/node/1541860 To work with: //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js How should I do this?

  • This is asking 2 questions in one so I'm ignoring the jQuery one, post a separate question for that. The .info.yml in the question doesn't even parse, YAML is whitespace sensitive: Drupal\Core\Extension\InfoParserException: Unable to parse themes/adminimal_theme/adminimal.info.yml: Unable to parse at line 9 (near " stylesheets:"), so make sure your whitespace lines up. stylesheets has an extra leading space and the line declaring style.css is indented by one space too many (it will probably forgive you for that though). – Cottser Nov 7 '14 at 14:43
1

Working for me creating drupal8 theme using bartik theme as base theme. Successfully call the css file present in my custom theme. Hopes this will helps you.

name: Smart
type: theme
description: 'Smart business templates'
core: '8.x'
package: Custom
base theme: bartik
project: 'drupal'
stylesheets-remove:
 - colors.css
stylesheets-override:
 - css/colors.css
regions:
 header: Header
 primary_menu: 'Primary menu'
 help: Help
 featured: Featured
 content: Content
 sidebar_first: 'First sidebar'  
 sidebar_second: 'Second sidebar'
 triptych_first: 'Triptych first'
 triptych_middle: 'Triptych middle'
 triptych_last: 'Triptych last'
 footer_firstcolumn: 'Footer first column'
 footer_secondcolumn: 'Footer second column'
 footer_thirdcolumn: 'Footer third column'
 footer_fourthcolumn: 'Footer fourth column'
 footer: Footer

settings:
 shortcut_module_link: false

Also take reference from https://www.drupal.org/node/1876600

  • Allright thanks that worked! but When i edit the css now it still ends up with the old styles before the edit after a refresh of the page and save of the css file? – Stefan Oct 31 '14 at 9:16
  • CSS compression and aggregation is enabled by default in Drupal 8, go to /admin/config/development/performance to disable it or better yet use the settings.local.php provided with core (see the bottom of settings.php and sites/example.settings.local.php). – Cottser Nov 7 '14 at 14:38
  • Also: to just add a new stylesheet you shouldn't need to use stylesheets-override. – Cottser Nov 7 '14 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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