Skip to content
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
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ node_modules
Thumbs.db

# Generated files
*.html
!examples/*.html
api
plugins
components.json
file-sizes.json
_redirects
.prism
docs/plugins/*
!docs/plugins/plugins.11tydata.js
docs/components.json
docs/file-sizes.json
_site

# Cache
.cache
Expand Down
4 changes: 0 additions & 4 deletions README.json

This file was deleted.

304 changes: 0 additions & 304 deletions README.md

This file was deleted.

46 changes: 0 additions & 46 deletions _build/copy-plugins.mjs

This file was deleted.

88 changes: 0 additions & 88 deletions _build/eleventy.js

This file was deleted.

20 changes: 1 addition & 19 deletions _build/filters.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import * as path from "path";

export function relative (page) {
if (!page.url) {
return "";
}

let pagePath = page.url.replace(/[^/]+$/, "");
let ret = path.relative(pagePath, "/");

return ret || ".";
}

export function back_to_top (content) {
// Add “↑ Back to top” at the end of each `<section>`
return content.replace(/<\/section>/g, `<p><a href="#toc" class="back-to-top">↑ Back to top</a></p></section>`);
}

export function pretty_size (size) {
return Math.round(100 * size / 1024) / 100 + "KB";
return Math.round((100 * size) / 1024) / 100 + "KB";
}

export function parse_resources (resources = []) {
Expand Down
21 changes: 7 additions & 14 deletions _build/postinstall.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import { execSync } from "child_process";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const root = path.resolve(__dirname, "../node_modules");
const prismPath = path.join(root, "prismjs");
// Not node_modules/prismjs: markdown-it-prism, which highlights the docs, resolves the real
// `prismjs` package from there, and it needs v1
const root = path.resolve(__dirname, "..");
const prismPath = path.join(root, ".prism");

let sourcePath, destPath;

// --- Cloning & Installing Prism ---
console.log("[postinstall] Cloning Prism...");
// Ensure we work with a fresh copy
await fs.rm(prismPath, { recursive: true, force: true });
execSync("git clone https://github.com/PrismJS/prism.git prismjs", {
execSync("git clone https://github.com/PrismJS/prism.git .prism", {
cwd: root,
stdio: "inherit",
});
Expand All @@ -33,7 +35,7 @@ execSync("npm run build", {

// --- Working with plugins ---
sourcePath = path.join(prismPath, "src/plugins");
destPath = path.resolve(__dirname, "../plugins");
destPath = path.resolve(__dirname, "../docs/plugins");

async function copy () {
// We need { recursive: true } so the script doesn't fail if the folder already exists
Expand Down Expand Up @@ -71,18 +73,9 @@ catch (error) {
console.error(`[postinstall] Failed to copy Prism plugins docs: ${error.message}`);
}

// Create plugins.json in the plugins folder with global data
console.log("[postinstall] Creating plugins.json...");
let json = {
permalink: "{{ page.filePathStem.replace('README', '/index') }}.html",
tags: ["plugin"],
};

await fs.writeFile(path.join(destPath, "plugins.json"), JSON.stringify(json, null, "\t"));

// --- Copying other files (components.json, file-sizes.json, etc.) ---
sourcePath = path.join(prismPath, "dist");
destPath = path.resolve(__dirname, "..");
destPath = path.resolve(__dirname, "../docs");

let filenames = ["components.json", "file-sizes.json"];
for (let file of filenames) {
Expand Down
70 changes: 0 additions & 70 deletions _data/eleventyComputed.js

This file was deleted.

28 changes: 0 additions & 28 deletions _layouts/home.njk

This file was deleted.

Loading