Refactor into the recommended boilerplate-card #95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #72 by doing quite a large refactor to port our code into the boilerplate-card template.
Major conceptual changes:
render()
function just runs again with new state, and Lit-HTML takes care of applying necessary updates to the DOM). This means all of the logic for showing the state of entities is in therender()
function using html template syntax, and so are references to all the click callbacks.I've also added a Contributing section in the Readme with instructions on how to start a watch/devserver build and attach that to Home Assistant so you don't need to copy files around.
The built JS is now in the
/dist
directory (git ignore'd), and is split into separate files for the view and editor. This was just the format set up in boilerplate-card, but we could change it to a single output file if you'd prefer. I don't have much insight into the deployment process so @ikaruswill I might need your help on that. I did include (and have tested) their GitHub Actions which build these files and attach them to releases.