mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
71efff6827
* Update eslint config * Applied linter to lib * Applied eslint config to CliClient/app * Removed prettier due to https://github.com/prettier/prettier/pull/4765 * First pass on test units * Applied linter config to test units * Applied eslint config to clipper * Applied to plugin dir * Applied to root of ElectronClient * Applied on RN root * Applied on CLI root * Applied on Clipper root * Applied config to tools * test hook * test hook * test hook * Added pre-commit hook * Applied rule no-trailing-spaces * Make sure root packages are installed when installing sub-dir * Added doc
31 lines
1021 B
JavaScript
31 lines
1021 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');
|
|
// eslint-disable-next-line no-useless-escape
|
|
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);
|
|
});
|