usebedrock / bedrock

Bedrock is a static site generator to create large-scale HTML prototypes and document design systems
https://bedrockapp.org
Other
206 stars 28 forks source link

Request component markup via cURL #391

Open Wolfr opened 3 years ago

Wolfr commented 3 years ago

Feature request to be able to request component via cuRL. E.g.

curl -O http://projectname.company.com/styleguide/components/c-contact-card/c-contact-card-1.html

Resulting output:

<div class="c-panel">
    <div class="c-panel__body">
        <div class="c-contact-card">
            <div class="u-spacer-bottom">
                <div class="c-avatar c-avatar--large">PB</div>
                <div class="c-contact-card__title">Pagac Buildings</div>
                <p class="c-body-2">Construction</p>
            </div>
            <ul class="c-tag-list">
                <li class="c-tag">Residences</li>
                <li class="c-tag">Durable</li>
            </ul>
        </div>
    </div>
</div>
thusc commented 3 years ago

There are two use cases that make this feature interesting:

Wolfr commented 3 years ago

Thank you @thusc for your clarificiation.

BTW above example is a combined component so probably not the neatest example.

thusc commented 3 years ago

Actually combined components are quite useful, because it means that you can also validate the logic to combine them used by other implementations (e.g. should I wrap a table in an additional div when I embed it in a more complete page ?).

thusc commented 3 years ago

As an example for the second bullet points above about the fragments, consider those three pages:

We can clearly see how, starting with the first screen, we could use something like an AJAX call to only fetch the HTML fragment containing the result of the simulation, and inject it at the right place to avoid a full page refresh when submitting the form. For instance this can be achieved with htmx.

Wolfr commented 3 years ago

Correct URLs are: