You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a proposal(WIP), I do not have a working version, this is purely theory. I want to discuss the pros and cons and whether it's worth pursuing this idea because it will come with problems and benefits. It likely cannot be done in a single PR. We can try, but I imagine it will have consequences later that will have to be smoothed out.
A page template selected for each .md file(page-template.js by default) is then used to scaffold a new web component that contains that .md file exported component within scaffold.js. The newly scaffolded component is put in scratch directory and imported to app.js
Suggested changes
Remove writePageComponentFromTemplate() from scaffold.js and place it instead in the wc-markdown-loader. Using the graph, load the required template from within the loader and build using the template here.
We will then have to change the imports file list.js to use markdown files and not the scaffolded .js files within scratch directory.
Pros
assuming we can adjust import path context:
make global css much easier
make meta much easier
make page template styling easier(no additional shadow dom, no need to import duplicate css and render it within each individual md file as we currently are in mock-app)
may make live-reload in develop easier
may be more modular, more reliant on webpack loaders, making it easier to modularize for plugins etc in the future
Cons
we may not be able to adjust import path so that it's relative to user workspace
may encounter issues with list.js using markdown from the user workspace instead of js from scratch directory
may encounter issues with the current context replacement, which was tricky to setup
I'll update pros and cons on the list if you have any ideas or criticism here. It may not be worth the effort to do.
The text was updated successfully, but these errors were encountered:
hutchgrant
changed the title
RFC: Move page template scaffold to webpack wc-markdown-loader
[RFC] Move page template scaffold to webpack wc-markdown-loader
Apr 28, 2019
Type of Change
Summary
This is a proposal(WIP), I do not have a working version, this is purely theory. I want to discuss the pros and cons and whether it's worth pursuing this idea because it will come with problems and benefits. It likely cannot be done in a single PR. We can try, but I imagine it will have consequences later that will have to be smoothed out.
Currently
.md files are loaded via wc-markdown-loader, they're built into web components and exported e.g.
<wc-md-hello></wc-md-hello>
.A page template selected for each .md file(page-template.js by default) is then used to scaffold a new web component that contains that .md file exported component within
scaffold.js
. The newly scaffolded component is put in scratch directory and imported to app.jsSuggested changes
Remove
writePageComponentFromTemplate()
fromscaffold.js
and place it instead in the wc-markdown-loader. Using the graph, load the required template from within the loader and build using the template here.We will then have to change the imports file
list.js
to use markdown files and not the scaffolded .js files within scratch directory.Pros
assuming we can adjust import path context:
Cons
list.js
using markdown from the user workspace instead of js from scratch directoryI'll update pros and cons on the list if you have any ideas or criticism here. It may not be worth the effort to do.
The text was updated successfully, but these errors were encountered: