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

Update test and example pages to use Autoloader #1936

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Jun 9, 2019

This PR makes the test and example pages use the Autoloader to load language definitions.

Motivation

I wanted to get rid of this copypasted code altogether.


This is based on #1935.

scripts/examples.js Outdated Show resolved Hide resolved
@mAAdhaTTah mAAdhaTTah changed the title The test and example pages using Autoloader Update test and example pages to use Autoloader Sep 3, 2019
@RunDevelopment
Copy link
Member Author

@RunDevelopment RunDevelopment commented Oct 1, 2019

I should have communicated this earlier but this PR has one major issue: Extensions.
When you select an extension like CSS Extras on the test page, the Autoloader will go into an infinite loop loaden prism-css-extras.js about 100/s (localhost). This is because of the way Autoloader decides whether a language has been loaded yet by checking Prism.languages['css-extras'].
The problem: For extensions, this property remains undefined.

If you assume that languages won't be uploaded again after they are loaded, Autoloader could just keep an internal record of every loaded language as an addition to Prism.languages.
This is a breaking change because you won't be able to load a language again after unloading it, but how unloads languages on their website?

I'll implement this soon, so please re-review after that.
@mAAdhaTTah @Golmote

@github-actions
Copy link

@github-actions github-actions bot commented Oct 5, 2021

No JS Changes

Generated by 🚫 dangerJS against d1d4349

@RunDevelopment
Copy link
Member Author

@RunDevelopment RunDevelopment commented Oct 5, 2021

soon

±2 years.


Since the extension issue has since been solved and the PR has already been approved, I'll just merge this now.

@RunDevelopment RunDevelopment merged commit 3d96eed into PrismJS:master Oct 5, 2021
11 checks passed
@RunDevelopment RunDevelopment deleted the test-and-examples-using-autoloader branch Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants