Skip to content
Snippets Groups Projects
Verified Commit 5be8d550 authored by Louis's avatar Louis :fire:
Browse files

Set up flit post-processing for HTML

parent 2d81d034
No related branches found
No related tags found
No related merge requests found
[build]
public_url = "./"
\ No newline at end of file
public_url = "/"
[[hooks]]
stage = "post_build"
command = "sh"
command_arguments = ["-c", "flit -i $TRUNK_STAGING_DIR/index.html -f $TRUNK_SOURCE_DIR/flit.toml --inline"]
\ No newline at end of file
["script[type='module']"]
action = "wrap"
template ='''
<div id="root">
<button id="start_game">Start Game</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('start_game').addEventListener('click', function() {
let element = document.createElement('{{{TAG}}}');
let attr_string = `{{{ATTR}}}`
attr_string.split(' ').forEach(function(attr) {
let attr_array = attr.split('=');
element.setAttribute(attr_array[0], attr_array[1].slice(1, -1));
});
element.innerHTML = `{{{CONTENT}}}`;
document.body.appendChild(element);
});
});
</script>'''
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment