diff --git a/.vscode/settings.json b/.vscode/settings.json index 7c3e9fa3..39e1c49c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ "**/node_modules": true, "**/bower_components": true, "**/release": true - } + }, + "typescript.tsdk": "./node_modules/typescript/lib" } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 8b990411..a0083ca8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,6 +8,8 @@ var rimraf = require('rimraf'); var cp = require('child_process'); var httpServer = require('http-server'); var typedoc = require("gulp-typedoc"); +var CleanCSS = require('clean-css'); +var uncss = require('uncss'); var WEBSITE_GENERATED_PATH = path.join(__dirname, 'website/playground/new-samples'); var MONACO_EDITOR_VERSION = (function() { @@ -247,6 +249,16 @@ function addPluginThirdPartyNotices() { gulp.task('clean-website', function(cb) { rimraf('../monaco-editor-website', { maxBusyTries: 1 }, cb); }); gulp.task('website', ['clean-website'], function() { + function replaceWithRelativeResource(dataPath, contents, regex, callback) { + return contents.replace(regex, function(_, m0) { + var filePath = path.join(path.dirname(dataPath), m0); + return callback(m0, fs.readFileSync(filePath)); + }); + } + + var waiting = 0; + var done = false; + return ( es.merge( gulp.src([ @@ -254,7 +266,7 @@ gulp.task('website', ['clean-website'], function() { '!website/typedoc-theme/**' ], { dot: true }) .pipe(es.through(function(data) { - if (!data.contents || !/\.(html)$/.test(data.path)) { + if (!data.contents || !/\.(html)$/.test(data.path) || /new-samples/.test(data.path)) { return this.emit('data', data); } @@ -263,13 +275,73 @@ gulp.task('website', ['clean-website'], function() { contents = contents.replace(/{{version}}/g, MONACO_EDITOR_VERSION); // contents = contents.replace('© 2016 Microsoft', '© 2016 Microsoft [' + builtTime + ']'); - data.contents = new Buffer(contents); + // Preload xhr contents + contents = replaceWithRelativeResource(data.path, contents, /
'
+						+ fileContents.toString('utf8')
+							.replace(/&/g, '&')
+							.replace(//g, '>')
+						+ '
' + ); + }); - this.emit('data', data); + // Inline fork.png + contents = replaceWithRelativeResource(data.path, contents, /src="(\.\/fork.png)"/g, function(m0, fileContents) { + return ( + 'src="data:image/png;base64,' + fileContents.toString('base64') + '"' + ); + }); + + var allCSS = ''; + var tmpcontents = replaceWithRelativeResource(data.path, contents, /' + output + ''; + } + return ''; + }); + } + + // Inline javascript + contents = replaceWithRelativeResource(data.path, contents, /'; + }); + + data.contents = new Buffer(contents.split(/\r\n|\r|\n/).join('\n')); + this.emit('data', data); + + if (done && waiting === 0) { + this.emit('end'); + } + }.bind(this)); + + }, function() { + done = true; + if (waiting === 0) { + this.emit('end'); + } })) .pipe(gulp.dest('../monaco-editor-website')), - // node_modules\.bin\typedoc --mode file --out out src\monaco.d.ts --includeDeclarations --theme default --entryPoint monaco --name "Monaco Editor v0.7.0 API" --readme none --hideGenerator gulp.src('monaco.d.ts') .pipe(typedoc({ mode: 'file', diff --git a/package.json b/package.json index 608eeee3..0720e81e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "https://github.com/Microsoft/monaco-editor" }, "devDependencies": { + "clean-css": "^3.4.20", "event-stream": "^3.3.2", "gulp": "^3.9.1", "gulp-typedoc": "^2.0.0", @@ -27,6 +28,7 @@ "monaco-languages": "0.6.0", "monaco-typescript": "2.0.1", "rimraf": "^2.5.2", - "typedoc": "^0.5.0" + "typedoc": "^0.5.0", + "uncss": "^0.14.1" } } diff --git a/website/all.css b/website/all.css index 90cbad95..4f9a3ce1 100644 --- a/website/all.css +++ b/website/all.css @@ -225,6 +225,21 @@ body > section > .container { } +#gh-link { + display: none; + position: fixed; + top: 0; + right: 0; + border: 0; + margin:0; + z-index: 1000; +} +@media (min-width: 980px) { + #gh-link { + display: block; + } +} + @media (min-width: 980px) { .navbar .nav { float: right; diff --git a/website/fork.png b/website/fork.png new file mode 100644 index 00000000..7dc1afca Binary files /dev/null and b/website/fork.png differ diff --git a/website/index.html b/website/index.html index 365b7c43..d0c9464e 100644 --- a/website/index.html +++ b/website/index.html @@ -9,17 +9,20 @@ Monaco Editor - - - - + + + + - + - Fork me on GitHub - +

+	

+	

+	Fork me on GitHub