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

feat(generate-examples-index)!: complete overhaul #6

Merged
merged 4 commits into from Jan 5, 2020

Conversation

Thomaash
Copy link
Member

@Thomaash Thomaash commented Jan 2, 2020

BREAKING CHANGE: The API differs a lot.

Vuepress compatible Markdown output. I would like all of the stuff to be
a part of Vuepress so that we don't have different design for each thing
like we do now. I hope you won't protest against this.

Styles and playground data are now separated from HTML. This decreased
the size of index.html by an order of magnitude (from about 1 MiB to
less than 100 KiB in Vis Network). Previously all the code (JS, HTML and
CSS) for each example was in the index itself twice (once for JSFiddle
and once for CodePen). This wasn't that big of a deal for browsers (what
is a megabyte here or there nowadays) but it made Vuepress crash. The
problem was that it interpreted only a part of the attributes containing
the code and tried to interpret the remainder as Markdown/HTML and ended
with errors because the remainder wasn't valid. This way a static page
with code only for one example is opened and a form button in it is
automatically clicked by JS to open the playground.

The generated HTML is generally simplyfied with only small tweaks to
design. These include playground links being first instead of last and
the images having blue background when they fail to load instead of
being transparent.

More information is logged to the console for easier debugging and just
to give better idea about what is going on.

The directory structure of generated files is now more finely
configurable. This is necessary for Vuepress compatibility.

Configuration can now be saved in a JSON file instead of an awkwardly
long argument list in package.json.

Internally it is now modular instead of monolithic. This is important
for HTML and Markdown coexistence as well as general maintainability (it
turned out much bigger than I originally expected).

HTML

Screenshot from 2020-01-02 23-06-27

Markdown

Screenshot from 2020-01-02 23-03-35

PS: The Markdown version could look nice with some short descriptions between the screenshot and the links. Would you support such feature?

BREAKING CHANGE: The API differs a lot.

Vuepress compatible Markdown output. I would like all of the stuff to be
a part of Vuepress so that we don't have different design for each thing
like we do now. I hope you won't protest against this.

Styles and playground data are now separated from HTML. This decreased
the size of index.html by an order of magnitude (from about 1 MiB to
less than 100 KiB in Vis Network). Previously all the code (JS, HTML and
CSS) for each example was in the index itself twice (once for JSFiddle
and once for CodePen). This wasn't that big of a deal for browsers (what
is a megabyte here or there nowadays) but it made Vuepress crash. The
problem was that it interpreted only a part of the attributes containing
the code and tried to interpret the remainder as Markdown/HTML and ended
with errors because the remainder wasn't valid. This way a static page
with code only for one example is opened and a form button in it is
automatically clicked by JS to open the playground.

The generated HTML is generally simplyfied with only small tweaks to
design. These include playground links being first instead of last and
the images having blue background when they fail to load instead of
being transparent.

More information is logged to the console for easier debugging and just
to give better idea about what is going on.

The directory structure of generated files is now more finely
configurable. This is necessary for Vuepress compatibility.

Configuration can now be saved in a JSON file instead of an awkwardly
long argument list in package.json.

Internally it is now modular instead of monolithic. This is important
for HTML and Markdown coexistence as well as general maintainability (it
turned out much bigger than I originally expected).
@Thomaash Thomaash requested a review from a team January 2, 2020 23:24
Mostly added docs and other comments explaining what's going on in the
code. There is also some minor refactoring and other small changes that
don't affect the functionality.
The support files use path hashes for unique identification. The
absolute path was used which resulted in CI tests failing because the
path was different on each computer. This should resolve the issue.

Also since it is the same for all URLs related to the same example it is
now generated only once for each example and reused rather than
regenerated for each URL again.
Copy link
Member

@yotamberk yotamberk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Wow!
You're a beast!

@Thomaash Thomaash merged commit 6495c63 into master Jan 5, 2020
@Thomaash Thomaash deleted the overhaul-generate-examples-index branch January 5, 2020 19:57
@vis-bot
Copy link
Collaborator

vis-bot commented Jan 5, 2020

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants