Skip to content

Commit

Permalink
Include *.mjs files into javascript_files()
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Jun 3, 2023
1 parent 693ceaa commit 3d64227
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mkdocs/livereload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def _log_poll_request(cls, url, request_id):
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"
Expand Down
2 changes: 1 addition & 1 deletion mkdocs/structure/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def is_media_file(self) -> bool:

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."""
Expand Down

0 comments on commit 3d64227

Please sign in to comment.