|
@@ -14,6 +14,18 @@ var MAP_LANGUAGES = {
|
|
'html': 'markup'
|
|
'html': 'markup'
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// Base languages syntaxes, extended by other syntaxes, need to be
|
|
|
|
+// required before all.
|
|
|
|
+var PRELUDE = ['clike', 'javascript', 'markup', 'c', 'ruby', 'css'];
|
|
|
|
+PRELUDE.map(requireSyntax);
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Load the syntax definition for a language id
|
|
|
|
+ */
|
|
|
|
+function requireSyntax(lang) {
|
|
|
|
+ require('prismjs/components/prism-' + lang + '.js');
|
|
|
|
+}
|
|
|
|
+
|
|
function getAssets() {
|
|
function getAssets() {
|
|
|
|
|
|
var cssFiles = this.config.get('pluginsConfig.prism.css', []);
|
|
var cssFiles = this.config.get('pluginsConfig.prism.css', []);
|
|
@@ -61,7 +73,7 @@ module.exports = {
|
|
// Try and find the language definition in components folder
|
|
// Try and find the language definition in components folder
|
|
if (!languages[lang]) {
|
|
if (!languages[lang]) {
|
|
try {
|
|
try {
|
|
- require('prismjs/components/prism-' + lang + '.js');
|
|
|
|
|
|
+ requireSyntax(lang);
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.warn('Failed to load prism syntax: ' + lang);
|
|
console.warn('Failed to load prism syntax: ' + lang);
|
|
console.warn(e);
|
|
console.warn(e);
|