Skip to content

Commit

Permalink
Merge branch 'master' into docs-minify-js
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jan 9, 2025
2 parents ef29b72 + 17a3b3b commit 211a202
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 67 deletions.
17 changes: 10 additions & 7 deletions bin/build-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
'use strict';

const Path = require('node:path');
const { promisify } = require('node:util');
const exec = promisify(require('node:child_process').exec);

var fs = require('fs');
const Path = require('node:path');

var replace = require('replace');
var exec = require('child-process-promise').exec;
var mkdirp = require('mkdirp');
var cssmin = require('cssmin');
const terser = require('terser');

var POUCHDB_CSS = __dirname + '/../docs/static/css/pouchdb.css';
var POUCHDB_LESS = __dirname + '/../docs/static/less/pouchdb/pouchdb.less';
const POUCHDB_CSS = resolvePath('docs/static/css/pouchdb.css');
const POUCHDB_LESS = resolvePath('docs/static/less/pouchdb/pouchdb.less');

process.chdir('docs');

Expand All @@ -23,8 +26,8 @@ function checkJekyll() {
}

function buildCSS() {
mkdirp.sync(__dirname + '/../docs/static/css');
var cmd = __dirname + '/../node_modules/less/bin/lessc ' + POUCHDB_LESS;
mkdirp.sync(resolvePath('docs/static/css'));
const cmd = [ resolvePath('node_modules/less/bin/lessc'), POUCHDB_LESS ].join(' ');
return exec(cmd).then(function (child) {
var minifiedCss = cssmin(child.stdout);
fs.writeFileSync(POUCHDB_CSS, minifiedCss);
Expand Down Expand Up @@ -64,11 +67,11 @@ function buildJekyll(path) {
}

function highlightEs6() {
var path = require('path').resolve(__dirname, '../docs/_site');
const path = resolvePath('docs/_site');

// TODO: this is a fragile and hacky way to get
// 'async' and 'await' to highlight correctly
// in this blog post.
// in blog posts & documentation.
replace({
regex: '<span class="nx">(await|async|of)</span>',
replacement: '<span class="kd">$1</span>',
Expand Down
59 changes: 0 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"chai": "3.5.0",
"chai-as-promised": "5.3.0",
"change-case": "4.0.1",
"child-process-promise": "2.2.1",
"cssmin": "0.4.3",
"denodeify": "1.2.1",
"derequire": "2.1.1",
Expand Down

0 comments on commit 211a202

Please sign in to comment.