I'm trying to theme a Drupal 8 site. I have my .info file inside my theme folder. Alone this works (shows up under appearance menu). When I add css and js files via the *.libraries.yml file, include the library in the .info file, I get this error-

The website encountered an unexpected error. Please try again later.
AssertionError: CSS files should be specified as key/value pairs, where the values are configuration options. See https://www.drupal.org/node/2274843. in assert() (line 132 of core\lib\Drupal\Core\Asset\LibraryDiscoveryParser.php).

*.info.yml file

name: Twig
type: theme
description: 'A Twig theme for demonstrating Twig syntax'
core: 8.x
base theme: false

libraries:
  - twig/global

*.libraries.yml file

global:
  version: 1.0
  css:
    theme:
      css/style.css: {}
    js:
      js/script.js
    dependencies:
      - core/jquery

Comments

wombatbuddy’s picture

You need to remove extra spaces before 'js:'
Before 'js:' must be two spaces just like before 'css:'
Also add {} after 'js/script.js' 

global:
  version: 1.0
  css:
    theme:
      css/style.css: {}
  js:
    js/script.js {}
  dependencies:
    - core/jquery