rumkin / pill

Add dynamic content loading to static sites with only 1 KiB of JS
https://rumkin.github.io/pill/
MIT License
383 stars 18 forks source link

new options for anchor tags and rendered area #24

Closed tamb closed 4 years ago

tamb commented 4 years ago

Ideally you should be able to specify an array of sections of anchor tags to take over (think top nav, and side nav) and then also have a rendering section

<div id="content"></div>

So options would have these additional fields:

{
  anchors: selector | selector[],
  renderArea: selector
}
rumkin commented 4 years ago

I think it should be done in the second version of the Pill when modular and plugin based architecture will be ready.

tamb commented 4 years ago

I could see this working as an added option in v1. It will guide the direction of the code for v2. I can try on a branch.

rumkin commented 4 years ago

Current goal of Pill is to be as small as possible to solve dynamic loading problem. And I want to focus on implementing browser-alike behaviour in smaller amount of code. And also avoid compatibility problems. And now Pill solves the problem you describe for uniform pages. What I want to solve in future version of Pill is an ability to switch between different page layouts without rewriting HTML. This is where this feature would be helpful. But it would require additional JS code to highlight current links which are out of render area and to sync page state with history. And all of this seems to me as v2.

rumkin commented 4 years ago

I've decided to close this as it would be a part of v2 so there is no need in special issue for that. Feel free to open if there will be new thoughts on that.