Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Move page template scaffold to webpack wc-markdown-loader #61

Closed
1 of 5 tasks
hutchgrant opened this issue Apr 28, 2019 · 2 comments
Closed
1 of 5 tasks

[RFC] Move page template scaffold to webpack wc-markdown-loader #61

hutchgrant opened this issue Apr 28, 2019 · 2 comments
Labels
invalid This doesn't seem right RFC Proposal and changes to workflows, architecture, APIs, etc

Comments

@hutchgrant
Copy link
Member

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

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.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.

@hutchgrant 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
@hutchgrant hutchgrant added the RFC Proposal and changes to workflows, architecture, APIs, etc label Apr 28, 2019
@thescientist13 thescientist13 added the invalid This doesn't seem right label Nov 8, 2020
@thescientist13
Copy link
Member

As part of #355 / #417 webpack wont be used in the project anymore, so this issue will become invalid once this gets merged and release.

@thescientist13 thescientist13 mentioned this issue Nov 12, 2020
12 tasks
@thescientist13
Copy link
Member

v0.10.0 released, webpack related issues no longer apply to the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right RFC Proposal and changes to workflows, architecture, APIs, etc
Projects
None yet
Development

No branches or pull requests

2 participants