Include *.mjs files into javascript_files()

This commit is contained in:
Oleh Prypin
2023-06-03 23:08:44 +02:00
parent 0f793b9984
commit cc63a4bedf
2 changed files with 2 additions and 2 deletions

View File

@@ -311,7 +311,7 @@ class LiveReloadServer(socketserver.ThreadingMixIn, wsgiref.simple_server.WSGISe
def _guess_type(cls, path):
# MkDocs only ensures a few common types (as seen in livereload_tests.py::test_mime_types).
# Other uncommon types will not be accepted.
if path.endswith((".js", ".JS")):
if path.endswith((".js", ".JS", ".mjs")):
return "application/javascript"
if path.endswith(".gz"):
return "application/gzip"

View File

@@ -269,7 +269,7 @@ class File:
def is_javascript(self) -> bool:
"""Return True if file is a JavaScript file."""
return self.src_uri.endswith(('.js', '.javascript'))
return self.src_uri.endswith(('.js', '.javascript', '.mjs'))
def is_css(self) -> bool:
"""Return True if file is a CSS file."""