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

Resources #1539

Open
RunDevelopment opened this issue Aug 23, 2018 · 1 comment
Open

Resources #1539

RunDevelopment opened this issue Aug 23, 2018 · 1 comment

Comments

@RunDevelopment
Copy link
Member

I would like to propose the concept for resources to Prism.

Concept

Resources are small JS files which contain one feature and can be required by plugins, languages, and other resources. They contain functions or constants and do not add new languages or plugin functionalities themselves.

Resources are supposed to encourage code reuse between different components and the addition of new features (even to Prism-core). Like this, even features which are only used by a small number of components and therefore disqualified from being added directly to Prism-core can be shared between said components.

Examples

One example of a resource we have right now is the markup-templating "language". It does not add any grammar to Prism and therefore should disqualify as a language.

The generated objects from gulp used by the AutoLoader and ShowLanguage plugin could be outsourced as resources in the case that other plugins need them as well.

Future resources could be shared patterns (#1494) and other functionality like #1476 or #1524.

Implementation

Resource should be located under ./resources and similar to other components have names of the form prism-{name}.js. Minified files will be generated by gulp.

They will be registered inside the new resources object in components.json.

This also means that we will have to change the current dependency system to allow for dependencies between different resource kinds (languages, plugins, resources).

@RunDevelopment
Copy link
Member Author

One note on the required dependency system:

I'm currently working on fixing #1490 and mAAdhaTTah/babel-plugin-prismjs#3. To do that, I wrote a new implementation of widely used dependency-related methods, which are used by the website, loadLanguages and our testing suite.

This means that it will be very easy to implement such a feature.

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

No branches or pull requests

1 participant