Skip to content

Preprocess the MINIMAL_RUNTIME HTML shell as an HTML file - #28464

Open
juj wants to merge 2 commits into
emscripten-core:mainfrom
juj:fix_minimal_runtime_shell_style
Open

juj wants to merge 2 commits into
emscripten-core:mainfrom
juj:fix_minimal_runtime_shell_style

Conversation

@juj

@juj juj commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Fix CSS style #foo directives inside <style> blocks in HTML files from being mistaken as C preprocessor directives.

Fixes: #13488

Comment thread tools/minimal_runtime_shell.py Outdated

temp_files = shared.get_temp_files()
with temp_files.get_file(suffix='.js') as shell_temp:
with temp_files.get_file(suffix=utils.suffix(options.shell_html)) as shell_temp:

@sbc100 sbc100 Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just hardcode .html here?

This might even be the better option since if .html is handled specially by read_and_preprocess (it seems odd that it is but whatever) then we really want to force this special handling here.. whatever the user names their shell file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. AI was being generic it looks like. Updated to html.

Comment thread test/test_other.py Outdated
{{{ DOWNLOAD_JS_AND_WASM_FILES }}}
</script>
</body>
</html>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this this file even smaller/simpler?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

juj and others added 2 commits December 1, 2026 15:41
The JS preprocessor leaves `<style>` blocks in HTML files alone (emscripten-core#7724),
because CSS id selectors such as `#results { ... }` look like
preprocessor directives. It tells HTML files from other files by their
suffix.

With MINIMAL_RUNTIME it is a temporary copy of the shell file that gets
preprocessed, and that copy was created with a `.js` suffix. A shell
file with such CSS then failed to build with `Unknown preprocessor
directive #results`. Give the temporary copy the suffix of the shell
file instead.

Fixes: emscripten-core#13488

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juj
juj force-pushed the fix_minimal_runtime_shell_style branch from 2d1a7b1 to b2c97e8 Compare December 1, 2026 13:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: JS preprocessor is run on HTML files, failing on CSS styles

2 participants