To add to a Drupal module:
https://www.drupal.org/node/2274843
To add to a Drupal theme:
https://www.drupal.org/node/2216195
create a hello_world.libraries.yml (module_name.libraries.yml) file and inside it would look like this: create a hello_world.libraries.yml (module_name.libraries.yml) file and inside it would look like this: hello-world: version: 1.x css: theme: css/hello_world.css: {} Then you can attach the css within the library to the render array like so: $element = array( '#markup' => 'Saying Hello World in Drupal 8 is cool!
' . $content, '#attached' => array( 'library' => array( 'hello_world/hello-world', ), ), ); return $element;