Fix: node.js hacks for components and prism.js
diff --git a/components/prism-core.js b/components/prism-core.js
index 6b57993..d59b09e 100644
--- a/components/prism-core.js
+++ b/components/prism-core.js
@@ -426,3 +426,8 @@ return _self.Prism;
if (typeof module !== 'undefined' && module.exports) {
module.exports = Prism;
}
+
+// hack for components to work correctly in node.js
+if (typeof global !== 'undefined') {
+ global.Prism = Prism;
+}
diff --git a/plugins/file-highlight/prism-file-highlight.js b/plugins/file-highlight/prism-file-highlight.js
index 1a49254..6a2a540 100644
--- a/plugins/file-highlight/prism-file-highlight.js
+++ b/plugins/file-highlight/prism-file-highlight.js
@@ -1,5 +1,5 @@
(function () {
- if (!self.Prism || !self.document || !document.querySelector) {
+ if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
return;
}