1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/Tools/copycss.js
Laurent Cozic 9289dbdf77
All: Refactor Markdown rendering (#1315)
* Refactoring MdToHtml to avoid manually rendering tokens

* Minor fix

* Fixed loading of resources

* Handle clicking on checkboxes

* Added back Katex support

* Fixed issues with Katex and note rendering

* Added back support for links

* Restored code block highlighting support

* clean up

* Applying update to mobile

* Fixed handling of links and cleaned up to share more code between mobile and desktop

* Restored content caching and improved handling of additional assets

* Clean up and a few fixes

* Applied more updates to mobile and added code highlighting support
2019-03-08 17:14:17 +00:00

29 lines
977 B
JavaScript

const fs = require('fs-extra');
const cwd = process.cwd();
const outputDir = cwd + '/lib/csstojs';
async function createJsFromCss(name, filePath) {
let css = await fs.readFile(filePath, 'utf-8');
css = css.replace(/\`/g, '\\`');
const js = 'module.exports = `' + css + '`;';
const outputPath = outputDir + '/' + name + '.css.js';
await fs.writeFile(outputPath, js);
}
async function main(argv) {
await fs.mkdirp(outputDir);
await createJsFromCss('katex', cwd + '/node_modules/katex/dist/katex.min.css');
await createJsFromCss('hljs-atom-one-light', cwd + '/node_modules/highlight.js/styles/atom-one-light.css');
await createJsFromCss('hljs-atom-one-dark-reasonable', cwd + '/node_modules/highlight.js/styles/atom-one-dark-reasonable.css');
if (argv.indexOf('--copy-fonts') >= 0) {
await fs.copy(cwd + '/node_modules/katex/dist/fonts', cwd + '/gui/note-viewer/fonts');
}
}
main(process.argv).catch((error) => {
console.error(error);
process.exit(1);
});