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

Add a loadComponents function for easy component loading on NodeJS #1359

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

Golmote
Copy link
Contributor

@Golmote Golmote commented Mar 15, 2018

This PR adds the loadComponents function mentionned in #972.

Usage:

var Prism = require('./components/prism-core.js');
var loadComponents = require('./components/index.js');
loadComponents(['c', 'javascript']);

@Golmote
Copy link
Contributor Author

Golmote commented Mar 19, 2018

@mAAdhaTTah Do you wish to do a quick review on this?

@mAAdhaTTah
Copy link
Member

Maybe loadLanguages would be more appropriate as a name, since it can't load other components, like themes or plugins?

Also, we get slightly less code if we just call load within the if block, e.g.:

if (components.languages[language] && components.languages[language].require) {
	loadComponents(components.languages[language].require);
}

@Golmote
Copy link
Contributor Author

Golmote commented Mar 20, 2018

Yes ! Both valid points. I updated the PR.

Copy link
Member

@mAAdhaTTah mAAdhaTTah left a comment

Choose a reason for hiding this comment

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

LGTM!

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

Successfully merging this pull request may close these issues.

None yet

2 participants