Comparing version 0.1.5 to 0.1.6-beta
79
build.js
#!/usr/bin/env node | ||
const dedent = require("dedent"); | ||
const ejs = require("ejs"); | ||
const fs = require("fs"); | ||
const hljs = require("highlight.js"); | ||
const mkdirp = require("mkdirp"); | ||
const postcss = require("postcss"); | ||
const glob = require("glob"); | ||
const path = require("path"); | ||
let id = 0; | ||
function getNewId() { | ||
return ++id; | ||
} | ||
function getCurrentId() { | ||
return id; | ||
} | ||
function example(code) { | ||
const magicBrackets = /\[\[(.*)\]\]/g; | ||
const dedented = dedent(code); | ||
const inline = dedented.replace(magicBrackets, "$1"); | ||
const escaped = hljs.highlight("html", dedented.replace(magicBrackets, "")) | ||
.value; | ||
return `<div class="example"> | ||
${inline} | ||
<details> | ||
<summary>Show code</summary> | ||
<pre><code>${escaped}</code></pre> | ||
</details> | ||
</div>`; | ||
} | ||
function buildDocs() { | ||
const template = fs.readFileSync("docs/index.html.ejs", "utf-8"); | ||
glob("build/*", (err, files) => { | ||
if (!err) { | ||
files.forEach((srcFile) => | ||
fs.copyFileSync(srcFile, path.join("docs", path.basename(srcFile))) | ||
); | ||
} else throw "error globbing build directory."; | ||
postcss() | ||
.use(require("postcss-inline-svg")) | ||
.use(require("postcss-css-variables")) | ||
.use(require("postcss-calc")) | ||
.use(require("postcss-copy")({ dest: "dist", template: "[name].[ext]" })) | ||
.use(require("cssnano")) | ||
.process(fs.readFileSync("style.css"), { | ||
from: "style.css", | ||
to: "dist/98.css", | ||
map: { inline: false }, | ||
}) | ||
.then((result) => { | ||
mkdirp.sync("dist"); | ||
fs.writeFileSync("dist/98.css", result.css); | ||
fs.writeFileSync("dist/98.css.map", result.map); | ||
}); | ||
fs.writeFileSync( | ||
"docs/index.html", | ||
ejs.render(template, { getNewId, getCurrentId, example }) | ||
); | ||
} | ||
function buildCSS() { | ||
return postcss() | ||
.use(require("postcss-inline-svg")) | ||
.use(require("postcss-css-variables")) | ||
.use(require("postcss-calc")) | ||
.use(require("postcss-copy")({ dest: "build", template: "[name].[ext]" })) | ||
.use(require("cssnano")) | ||
.process(fs.readFileSync("style.css"), { | ||
from: "style.css", | ||
to: "build/98.css", | ||
map: { inline: false }, | ||
}) | ||
.then((result) => { | ||
mkdirp.sync("build"); | ||
fs.writeFileSync("build/98.css", result.css); | ||
fs.writeFileSync("build/98.css.map", result.map); | ||
}); | ||
} | ||
buildCSS().then(buildDocs); |
@@ -0,0 +0,0 @@ The FontStruction “MS Sans Serif Bold” |
@@ -0,0 +0,0 @@ The font file in this archive was created using Fontstruct the free, online |
@@ -0,0 +0,0 @@ The FontStruction “MS Sans Serif” |
@@ -0,0 +0,0 @@ The font file in this archive was created using Fontstruct the free, online |
{ | ||
"name": "98.css", | ||
"version": "0.1.5", | ||
"version": "0.1.6-beta", | ||
"description": "A design system for building faithful recreations of old UIs", | ||
"main": "build/98.css", | ||
"main": "dist/98.css", | ||
"directories": { | ||
@@ -10,4 +10,4 @@ "doc": "docs" | ||
"scripts": { | ||
"test": "sh test.sh", | ||
"build": "node build.js" | ||
"build": "node build.js", | ||
"build:docs": "npm run build && node build-docs.js" | ||
}, | ||
@@ -14,0 +14,0 @@ "repository": { |
@@ -47,2 +47,8 @@ ## 98.css | ||
### Developing | ||
[`style.css`](https://github.com/jdan/98.css/blob/master/style.css) is where everything happens. | ||
`npm run build:docs` will compile `style.css` (and all fonts/icons/etc) and rebuild the docs/ directory which powers http://jdan.github.io/98.css. It's a static directory so serve it with your server of choice (I am partial to `python -m SimpleHTTPServer 3000`) to see your changes. | ||
### Issues, Contributing, etc. | ||
@@ -49,0 +55,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
281239
808
62
2