diff --git a/core/lib/Drupal/Core/Asset/Exception/InvalidCssDefinitionException.php b/core/lib/Drupal/Core/Asset/Exception/InvalidCssDefinitionException.php
new file mode 100644
index 0000000..def8439
--- /dev/null
+++ b/core/lib/Drupal/Core/Asset/Exception/InvalidCssDefinitionException.php
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Asset\Exception\InvalidCssDefinitionException.
+ */
+
+namespace Drupal\Core\Asset\Exception;
+
+/**
+ * Defines an exception if the library file is not keyed by a category.
+ */
+class InvalidCssDefinitionException extends \RunTimeException {
+
+}
diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
index 1c08bc9..eb78696 100644
--- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -8,6 +8,7 @@
 namespace Drupal\Core\Asset;
 
 use Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException;
+use Drupal\Core\Asset\Exception\InvalidCssDefinitionException;
 use Drupal\Core\Asset\Exception\InvalidLibraryFileException;
 use Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException;
 use Drupal\Core\Extension\ModuleHandlerInterface;
@@ -131,12 +132,29 @@ public function buildByExtension($extension) {
         //   and only once prior to rendering out an HTML page.
         if ($type == 'css' && !empty($library[$type])) {
           foreach ($library[$type] as $category => $files) {
+            if (empty($files)) {
+              // Allow empty categories.
+              if (defined('CSS_' . strtoupper($category))) {
+                unset($library[$type][$category]);
+                continue;
+              }
+              // Files are are in $category and $files is empty.
+              else {
+                throw new InvalidCssDefinitionException(sprintf("Every CSS asset must be nested under a SMACSS category in the %s.library.yml file ('%s' seems to be a file name, allowed categories are Base, Layout, Component, State, Theme)", $extension, $category));
+              }
+            }
             foreach ($files as $source => $options) {
               if (!isset($options['weight'])) {
                 $options['weight'] = 0;
               }
-              // Apply the corresponding weight defined by CSS_* constants.
-              $options['weight'] += constant('CSS_' . strtoupper($category));
+              // Check if the category is valid or not and apply the
+              // corresponding weight defined by the CSS_* constants.
+              if (defined('CSS_' . strtoupper($category))) {
+                $options['weight'] += constant('CSS_' . strtoupper($category));
+              }
+              else {
+                throw new InvalidCssDefinitionException(sprintf("You must use a valid SMACSS category to nest a CSS asset. %s is invalid in %s.libraries.yml. Allowed categories are Base, Layout, Component, State, Theme)", $category, $extension));
+              }
               $library[$type][$source] = $options;
             }
             unset($library[$type][$category]);
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
index 9865cb2..01d22ad 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -187,10 +187,72 @@ public function testBuildByExtensionWithMissingInformation() {
   }
 
   /**
-   * Tests the version property, and how it propagates to the contained assets.
+   * Tests that an exception is thrown when no CSS category is specified.
+   *
+   * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException
+   * @expectedExceptionMessage Every CSS asset must be nested under a SMACSS category
+   * @expectedExceptionMessage css_missing_category
+   *
+   * @covers ::buildByExtension
+   */
+  public function testBuildByExtensionWithMissingCSSCategory() {
+    $this->moduleHandler->expects($this->atLeastOnce())
+      ->method('moduleExists')
+      ->with('css_missing_category')
+      ->will($this->returnValue(TRUE));
+
+    $path = __DIR__ . '/library_test_files';
+    $path = substr($path, strlen($this->root) + 1);
+    $this->libraryDiscoveryParser->setPaths('module', 'css_missing_category', $path);
+
+    $this->libraryDiscoveryParser->buildByExtension('css_missing_category');
+  }
+
+  /**
+   * Tests that an exception is thrown when no an invalid CSS category is used.
+   *
+   * @expectedException \Drupal\Core\Asset\Exception\InvalidCssDefinitionException
+   * @expectedExceptionMessage You must use a valid SMACSS category to nest a CSS asset
+   * @expectedExceptionMessage css_invalid_category
    *
    * @covers ::buildByExtension
    */
+  public function testBuildByExtensionWithInvalidCSSCategory() {
+    $this->moduleHandler->expects($this->atLeastOnce())
+      ->method('moduleExists')
+      ->with('css_invalid_category')
+      ->will($this->returnValue(TRUE));
+
+    $path = __DIR__ . '/library_test_files';
+    $path = substr($path, strlen($this->root) + 1);
+    $this->libraryDiscoveryParser->setPaths('module', 'css_invalid_category', $path);
+
+    $this->libraryDiscoveryParser->buildByExtension('css_invalid_category');
+  }
+
+  /**
+   * Tests that no exception is thrown when an empty CSS category exists.
+   *
+   * @covers ::buildByExtension
+   */
+  public function testBuildByExtensionWithEmptyCSSCategory() {
+     $this->moduleHandler->expects($this->atLeastOnce())
+       ->method('moduleExists')
+       ->with('css_empty_category')
+       ->will($this->returnValue(TRUE));
+
+     $path = __DIR__ . '/library_test_files';
+     $path = substr($path, strlen($this->root) + 1);
+     $this->libraryDiscoveryParser->setPaths('module', 'css_empty_category', $path);
+
+     $this->assertSame($this->libraryDiscoveryParser->buildByExtension('css_empty_category'), array());
+   }
+
+   /**
+    * Tests the version property, and how it propagates to the contained assets.
+    *
+    * @covers ::buildByExtension
+    */
   public function testVersion() {
     $this->moduleHandler->expects($this->atLeastOnce())
       ->method('moduleExists')
diff --git a/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_invalid_category.libraries.yml b/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_invalid_category.libraries.yml
new file mode 100644
index 0000000..f26250d
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_invalid_category.libraries.yml
@@ -0,0 +1,4 @@
+example:
+  css:
+    invalid_category:
+      css/base.css: {}
diff --git a/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_missing_category.libraries.yml b/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_missing_category.libraries.yml
new file mode 100644
index 0000000..2532e4e
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Asset/library_test_files/css_missing_category.libraries.yml
@@ -0,0 +1,3 @@
+example:
+  css:
+    css/base.css: {}
diff --git a/core/tests/Drupal/Tests/Core/Asset/library_test_files/dependencies.libraries.yml b/core/tests/Drupal/Tests/Core/Asset/library_test_files/dependencies.libraries.yml
index 9a8b4dd..169d2f4 100644
--- a/core/tests/Drupal/Tests/Core/Asset/library_test_files/dependencies.libraries.yml
+++ b/core/tests/Drupal/Tests/Core/Asset/library_test_files/dependencies.libraries.yml
@@ -1,6 +1,7 @@
 example:
   css:
-    css/example.js: {}
+    theme:
+      css/example.css: {}
   dependencies:
     - external/example_external
     - example_module/example
