Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ module.exports = function (grunt) {
},
src: 'js-modules/run_prettify.js',
dest: 'src/run_prettify.js'
},
nodeprettify: {
options: {
context: {
RUN_PRETTIFY: true
}
},
src: 'js-modules/node_prettify.js',
dest: 'src/node_prettify.js'
}
},

Expand All @@ -50,7 +59,8 @@ module.exports = function (grunt) {
},
files: [
{src: 'src/prettify.js', dest: 'src/prettify.js'},
{src: 'src/run_prettify.js', dest: 'src/run_prettify.js'}
{src: 'src/run_prettify.js', dest: 'src/run_prettify.js'},
{src: 'src/node_prettify.js', dest: 'src/node_prettify.js'}
]
},
langs: {
Expand Down Expand Up @@ -144,7 +154,7 @@ module.exports = function (grunt) {
warning_level: 'VERBOSE',
language_in: 'ECMASCRIPT5',
compilation_level: 'ADVANCED',
charset: 'US-ASCII',
charset: 'US-ASCII'
},
prettify: {
options: {
Expand Down
16 changes: 16 additions & 0 deletions js-modules/node_prettify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

var IN_GLOBAL_SCOPE = false;

/* @include prettify.js */

var path = require('path');

module.exports = {
prettyPrint: prettyPrint,
prettyPrintOne: prettyPrintOne,
// include paths for css preprocessor support
includePaths: [
__dirname,
path.resolve(__dirname, '../styles')
]
};
7 changes: 5 additions & 2 deletions js-modules/prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ var PR;
* UI events.
* If set to {@code false}, {@code prettyPrint()} is synchronous.
*/
window['PR_SHOULD_USE_CONTINUATION'] = true;
var PR_SHOULD_USE_CONTINUATION = true
if (typeof window !== 'undefined') {
window['PR_SHOULD_USE_CONTINUATION'] = PR_SHOULD_USE_CONTINUATION;
}

/**
* Pretty print a chunk of code.
Expand All @@ -116,7 +119,7 @@ var prettyPrint;


(function () {
var win = window;
var win = (typeof window !== 'undefined') ? window : {};
// Keyword lists for various languages.
// We use things that coerce to strings to make them compact when minified
// and to defeat aggressive optimizers that fold large string constants.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"contributors": [
"Amro <[email protected]>"
],
"main": "src/prettify.js",
"main": "src/node_prettify.js",
"directories": {
"lib": "src",
"doc": "docs",
Expand Down
Loading