chore: optimize compressed css script by sy-records · Pull Request #2338 · docsifyjs/docsify

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: optimize compressed css script #2338

Changes from all commits

Commits

File filter

Filter by extension

Conversations

Failed to load comments.

Loading

Jump to

Jump to file

Failed to load files.

Loading

Diff view
Diff view

4 changes: 2 additions & 2 deletions build/build.js

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'path';
import { promises as fs } from 'fs';
import * as rollup from 'rollup';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import uglify from '@rollup/plugin-terser';
import replace from '@rollup/plugin-replace';
import chokidar from 'chokidar';
import path from 'path';
import { relative } from './util.js';
import { promises as fs } from 'fs';

const pkgPath = relative(import.meta, '..', 'package.json');
const pkgString = (await fs.readFile(pkgPath)).toString();
Expand Down

1 change: 1 addition & 0 deletions build/cover.js

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import { relative } from './util.js';

const read = fs.readFileSync;
const write = fs.writeFileSync;
const pkgPath = relative(import.meta, '..', 'package.json');
Expand Down

2 changes: 1 addition & 1 deletion build/emoji.js

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import fs from 'fs';
import path from 'path';
import axios from 'axios';

const filePaths = {
emojiMarkdown: path.resolve(process.cwd(), 'docs', 'emoji.md'),
Expand Down

7 changes: 5 additions & 2 deletions build/mincss.js

Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import cssnano from 'cssnano';
import path from 'path';
import fs from 'fs';
import cssnano from 'cssnano';

const files = fs.readdirSync(path.resolve('lib/themes'));
const files = fs
.readdirSync(path.resolve('lib/themes'))
.filter(file => !file.endsWith('min.css'));

files.forEach(file => {
file = path.resolve('lib/themes', file);
cssnano
.process(fs.readFileSync(file))
.then(result => {
file = file.replace(/\.css$/, '.min.css');
fs.writeFileSync(file, result.css);
})
.catch(e => {
Expand Down