Skip to content
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

Add theme support #94

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ const postcss = require("postcss");

const { homepage, version } = require("./package.json");

function buildCSS() {
function buildCSS(preserveVariables) {
const input =
`/*! 98.css v${version} - ${homepage} */\n` + fs.readFileSync("style.css");
const destination = preserveVariables ? "dist/98-full.css" : "dist/98.css";
const template = preserveVariables ? "[name]-full.[ext]" : "[name].[ext]";

return postcss()
.use(require("postcss-inline-svg"))
.use(require("postcss-css-variables"))
.use(require("postcss-css-variables")({ preserve: preserveVariables }))
.use(require("postcss-calc"))
.use(require("postcss-copy")({ dest: "dist", template: "[name].[ext]" }))
.use(require("postcss-copy")({ dest: "dist", template }))
.use(require("cssnano"))
.process(input, {
from: "style.css",
to: "dist/98.css",
to: destination,
map: { inline: false },
})
.then((result) => {
mkdirp.sync("dist");
fs.writeFileSync("dist/98.css", result.css);
fs.writeFileSync("dist/98.css.map", result.map.toString());
fs.writeFileSync(destination, result.css);
fs.writeFileSync(destination + ".map", result.map.toString());
});
}

Expand Down Expand Up @@ -72,7 +74,8 @@ function buildDocs() {
}

function build() {
buildCSS()
buildCSS(false)
.then(() => buildCSS(true))
.then(buildDocs)
.catch((err) => console.log(err));
}
Expand Down
6 changes: 6 additions & 0 deletions docs/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ body {
margin: 0;
padding: 0;
background: #c0c0c0;
background: var(--button-face, #c0c0c0);
}

main {
Expand Down Expand Up @@ -80,6 +81,7 @@ blockquote {
margin: 0 0 20px;
padding: 20px;
background: #dfdfdf;
background: var(--button-light, #dfdfdf);
}

blockquote footer {
Expand All @@ -90,6 +92,7 @@ blockquote footer {
margin: 16px 0;
padding: 12px 24px;
border-left: 1px solid #808080;
border-left: 1px solid var(--button-shadow, #808080);
}

details {
Expand All @@ -112,12 +115,15 @@ details[open] summary {

button.focused {
outline: 1px dotted #000000;
outline: 1px dotted var(--button-text, #000000);
outline-offset: -4px;
}

button.active {
box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a,
inset -2px -2px #dfdfdf, inset 2px 2px #808080;
box-shadow: inset -1px -1px var(--button-hilight, #ffffff), inset 1px 1px var(--button-shadow, #0a0a0a),
inset -2px -2px var(--button-light, #dfdfdf), inset 2px 2px var(--button-dk-shadow, #808080);
}

@media (max-width: 480px) {
Expand Down
Loading