Skip to content

Commit

Permalink
Fix: node.js hacks for components and prism.js
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Sep 3, 2015
1 parent fd54995 commit 9f5c93c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion plugins/file-highlight/prism-file-highlight.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function () {
if (!self.Prism || !self.document || !document.querySelector) {
if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
return;
}

Expand Down

0 comments on commit 9f5c93c

Please sign in to comment.