Repository: mkdocs/mkdocs

Issue:
Empty or non-defined extra_css generates warning
I have a bit of css files in my project that I *don't* want  to include in `extra_css`.

With 0.17, even if I define empty lists in `mkdocs.yml`, I get a warning that makes `--strict` building fail.

For instance, with this in `mkdocs.yml`
```yaml
extra_css:
  - ' '
```
I get:
```
$ mkdocs build --strict
WARNING -  Config value: 'extra_css'. Warning: Some files in your 'docs_dir' are not listed in the 'extra_css' config setting and will be ignored by the theme. Add the following files to the 'extra_css' config setting if you want them to have an effect on the theme: ['file.css']

Aborted with 1 Configuration Warning in 'strict' mode!
```
The exact same thing happens if I remove the `extra_css` part from `mkdocs.yml`.

Is there a way to build in `strict` mode while making sure that extra CSS files are not added to the project?


Discussion:
No, not at this time, although, that should be temporary. Prior to this release, all CSS files in your `docs_dir` were automatically added to `extra_css` if the setting was empty. During the transition, we are issuing a warning for those users who now need to add a list of files to the setting. I expect the warning will be downgraded to an "info" message in the future.
All right, thanks for the clarification. I guess I'll build without `--strict` for now.

Resolving patch:
diff --git a/mkdocs/config/config_options.py b/mkdocs/config/config_options.py
--- a/mkdocs/config/config_options.py
+++ b/mkdocs/config/config_options.py
@@ -450,7 +450,7 @@ def __init__(self, file_match=None, **kwargs):
 
     def run_validation(self, value):
         if isinstance(value, list):
-            return list(os.path.normcase(path) for path in value)
+            return value
         else:
             raise ValidationError(
                 "Expected a list, got {0}".format(type(value)))
@@ -476,18 +476,17 @@ def walk_docs_dir(self, docs_dir):
                     yield relpath
 
     def post_validation(self, config, key_name):
-        missing_extras = []
-        for filename in self.walk_docs_dir(config['docs_dir']):
-            if filename not in config[key_name]:
-                missing_extras.append(filename)
-
-        if missing_extras:
-            self.warnings.append((
-                "Some files in your 'docs_dir' are not listed in the '{0}' "
-                "config setting and will be ignored by the theme. Add the "
-                "following files to the '{0}' config setting if you want "
-                "them to have an effect on the theme: ['{1}']"
-            ).format(key_name, "', '".join(missing_extras)))
+        # Only issue warnings for missing files if the setting is empty
+        # as autopopulating only used to work if the setting was empty.
+        if not config[key_name]:
+            actual_files = list(self.walk_docs_dir(config['docs_dir']))
+            if actual_files:
+                self.warnings.append((
+                    "Some files in your 'docs_dir' are not listed in the '{0}' "
+                    "config setting and will be ignored by the theme. Add the "
+                    "following files to the '{0}' config setting if you want "
+                    "them to have an effect on the theme: ['{1}']"
+                ).format(key_name, "', '".join(actual_files)))
 
 
 class Pages(OptionallyRequired):


Test patch: