Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
CSS Url, instead of taking up lots of space
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs Bunny committed Jan 24, 2021
1 parent 9fd431b commit e5d7386
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1,972 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
var showdown = require('showdown');
converter = new showdown.Converter();
var css = 'https://markdownpedia.tk/server/vital/style.css';
var fsExtra = require('fs-extra');
var fs = require('fs');
var style = fs.readFileSync('vital/style.css') + '';

fsExtra.emptyDirSync('site/html');
var e404 = fs.readFileSync('vital/404.md') + '';
var html = converter.makeHtml(e404);
html = html + '<style>' + style + '</style>';
html = html + `<link rel="stylesheet" href="${css}">`;
fs.writeFileSync('vital/404.html', html);
getfiles('site/markdown');
function getfiles(dir){
Expand All @@ -30,7 +31,7 @@ function convert(file, dir){
var content = converter.makeHtml(fs.readFileSync(filename) + '');
filename = filename.replace('site/markdown', 'site/html');
filename = filename.replace('.md', '.html');
var data = content + '<style>' + style + '</style>';
var data = content + `<link rel="stylesheet" href="${css}">`;
checkIfDir(dir.replace('site/markdown', 'site/html'));
fs.writeFileSync(filename, data);
console.log('File is ' + file + ' and is in ' + dir);
Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var path = require('path');
var app = express();
var port = 8000;
app.use(express.static('site/html'));
app.use('/server/vital', express.static(path.join(__dirname, 'vital')))
app.use(function(req, res, next) {
res.status(404);
res.sendFile(path.join(__dirname, 'vital', '404.html'));
Expand Down
Loading

0 comments on commit e5d7386

Please sign in to comment.