Skip to content

Commit

Permalink
Merge pull request #754 from valorkin/fix-correct-behaviour-in-nodejs
Browse files Browse the repository at this point in the history
Fix: node.js hacks for components and prism.js
  • Loading branch information
Golmote committed Sep 3, 2015
2 parents 8cf9e6a + 9f5c93c commit de7a5ca
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 @@ -422,3 +422,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 de7a5ca

Please sign in to comment.