Closed devlinjunker closed 4 years ago
I think we might want to use this webpack-underscore-loader for the static templates (may want to rename the top level components/
directory to something like static/
.
Then we can use handlebars maybe for dynamic templates/components, this will make it easy to use Fractal for a styleguide
It looks like handlebars can be used for both the compiled “static” and rendered “component” templates (again I think we should make the difference being wether or not javascript is included/needed for them)
In handlebars they are called dynamic partials, where we can pass values in through the handlebar partial parameters
So handlebars is great for templating the HTML and structure of the page.... However for now, I am just using vanilla JS and functions to create the DOM and attach handlers to elements but this still feels clunky... https://github.com/devlinjunker/template.webpack.fend/pull/11/files#diff-99f85621a787732f493ae3952ad09617R25
https://github.com/hadijaveed/reactive-handlebars looks interesting for managing handlers and updating the DOM when properties change... added some todos about that
also https://medium.com/@hadijaveed/writing-reactive-templates-with-handlebarsjs-c163a2816510
Got svg icons to be inlined during build process on simple handlebars partials: https://github.com/devlinjunker/template.webpack.fend/pull/11/commits/36d682405d656eb05638732d3175364cc237628a
Quite the task to figure out how to precompile the handlebars partials to in-line svgs
Q: Will this work on larger things?
Tests:
Styling:
TODO Create Separate PRS into this one for each new idea (help keep code changes small -- eventually this will be a huge PR but you can go through smaller ones to see the individual changes)
Q: Should we just create html-inline-loader (html-svg-inline-loader?)
@inline()
and replaces with contents of file? just svg?progress report:
Attempting Partial Linting:
./src/components/form/checkbox.hbs
18:6 error A block may only be used inside an HTML element or another block. undefined
./src/components/list/list-item.hbs 2:2 error Handlebars partials are not supported: "{{> (lookup . 'template')" at L2:C2 undefined
- looked into html linters but couldn't find any that looked like small libraries and/or didn't require access to the internet to validate
Description
Trying to break out separate UI sections and code into smaller "components" that can be added to HTML Pages and are re-usable. We want to also maybe include each of these in the styleguide (todo later)
Set up a basic todo list example app in another folder with a new js entry point
It seems like we can have two different types of components/templates
Important changes here
Related
N/A
Visual
TODO
src/components/
tosrc/static
for static HTML componentsREADME.component.md
insrc/todo/component
README.model.md
insrc/todo/model
Reactive handlebars for events?seems way out of dateBetter Event Handling/Rendering setupsee notes: https://github.com/devlinjunker/template.webpack.fend/pull/23/files#diff-5ed0e14e21a91f683c6c72d5447771a7R25Prettydiff?installed, but doesn't really lint html files, only beautifies them"
for attributes