diff --git a/package.json b/package.json index e33a90a..1612fe7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Markdown/HTML to PDF API with built-in invoice templates", "main": "dist/index.js", "scripts": { - "build:pages": "node scripts/build-pages.js && npx terser public/app.js -o public/app.min.js --compress --mangle", + "build:pages": "node scripts/build-html.cjs", "build": "node scripts/generate-openapi.mjs && npm run build:pages && tsc", "start": "node dist/index.js", "dev": "tsx src/index.ts", diff --git a/scripts/build-pages.js b/scripts/build-pages.js deleted file mode 100644 index 3b08b46..0000000 --- a/scripts/build-pages.js +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env node -/** - * Build-time HTML templating system for DocFast. - * No dependencies — uses only Node.js built-ins. - * - * - Reads page sources from templates/pages/*.html - * - Reads partials from templates/partials/*.html - * - Replaces {{> partial_name}} with partial content - * - Supports metadata comments at top of page files - * - Replaces {{key}} variables with extracted metadata - * - Writes output to public/ - */ - -import { readFileSync, writeFileSync, readdirSync } from 'node:fs'; -import { join } from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = fileURLToPath(new URL('.', import.meta.url)); -const ROOT = join(__dirname, '..'); -const PAGES_DIR = join(ROOT, 'templates', 'pages'); -const PARTIALS_DIR = join(ROOT, 'templates', 'partials'); -const OUTPUT_DIR = join(ROOT, 'public'); - -// Load all partials -const partials = {}; -for (const file of readdirSync(PARTIALS_DIR)) { - if (!file.endsWith('.html')) continue; - const name = file.replace('.html', ''); - partials[name] = readFileSync(join(PARTIALS_DIR, file), 'utf-8'); -} - -console.log(`Loaded ${Object.keys(partials).length} partials: ${Object.keys(partials).join(', ')}`); - -// Process each page -const pages = readdirSync(PAGES_DIR).filter(f => f.endsWith('.html')); -console.log(`Processing ${pages.length} pages...`); - -for (const file of pages) { - let content = readFileSync(join(PAGES_DIR, file), 'utf-8'); - - // Extract all metadata comments from the top - const vars = {}; - while (true) { - const m = content.match(/^\n?/); - if (!m) break; - vars[m[1]] = m[2]; - content = content.slice(m[0].length); - } - - // Replace {{> partial_name}} with partial content (support nested partials) - let maxDepth = 5; - while (maxDepth-- > 0 && content.includes('{{>')) { - content = content.replace(/\{\{>\s*([a-zA-Z0-9_-]+)\s*\}\}/g, (match, name) => { - if (!(name in partials)) { - console.warn(` Warning: partial "${name}" not found in ${file}`); - return match; - } - return partials[name]; - }); - } - - // Replace {{variable}} with extracted metadata - content = content.replace(/\{\{([a-zA-Z_-]+)\}\}/g, (match, key) => { - if (key in vars) return vars[key]; - console.warn(` Warning: variable "${key}" not defined in ${file}`); - return match; - }); - - // Write output - const outPath = join(OUTPUT_DIR, file); - writeFileSync(outPath, content); - console.log(` ✓ ${file} (${(content.length / 1024).toFixed(1)}KB)`); -} - -console.log('Done!'); diff --git a/templates/pages/docs.html b/templates/pages/docs.html deleted file mode 100644 index e99db2a..0000000 --- a/templates/pages/docs.html +++ /dev/null @@ -1,131 +0,0 @@ - - -
- - -Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)
- -Company: Cloonar Technologies GmbH
-Address: Linzer Straße 192/1/2, 1140 Wien, Austria
-Email: legal@docfast.dev
- -Commercial Register: FN 631089y
-Court: Handelsgericht Wien
-VAT ID: ATU81280034
-GLN: 9110036145697
- -Cloonar Technologies GmbH
- Legal contact: legal@docfast.dev
- Support: support@docfast.dev
Despite careful content control, we assume no liability for the content of external links. The operators of the linked pages are solely responsible for their content.
- -The content of our website has been created with the greatest possible care. However, we cannot guarantee that the content is current, reliable or complete.
- -Platform of the European Commission for Online Dispute Resolution (ODR): https://ec.europa.eu/consumers/odr
-Convert HTML, Markdown, or URLs to pixel-perfect PDFs. Built-in templates for invoices & receipts. No headless browser headaches.
-Already have an account? Lost your API key? Recover it →
- -Your data never leaves the EU • GDPR Compliant • Hetzner Germany (Nuremberg)
-Official SDKs for Node.js and Python. Or just use curl.
-Persistent browser pool — no cold starts. Your PDFs are ready before your spinner shows.
-Full CSS support including flexbox, grid, and custom fonts. Your brand, your PDFs.
-Invoice and receipt templates out of the box. Pass JSON data, get beautiful PDFs.
-REST API. JSON in, PDF out. Works with curl, Python, Node, Go — anything with HTTP.
-A4, Letter, custom sizes. Portrait or landscape. Headers, footers, and margins.
-HTTPS only. No data stored. PDFs stream directly to you — nothing touches disk.
-Pick a template or write your own HTML. Generate a real PDF in seconds.
- - -PDF generated in 0.4s
- Download PDF → -One plan. Everything included. No surprises.
-Last updated: February 16, 2026
- -Cloonar Technologies GmbH
- Address: Vienna, Austria
- Email: legal@docfast.dev
- Data Protection Contact: privacy@docfast.dev
Purpose: Payment processing for Pro subscriptions
- Data: Email, payment information
- Location: EU (GDPR compliant)
- Privacy Policy: https://stripe.com/privacy
Purpose: Server hosting and infrastructure
- Data: All data processed by DocFast
- Location: Germany (Nuremberg)
- Privacy Policy: https://www.hetzner.com/legal/privacy-policy
To exercise your rights: Email privacy@docfast.dev
- -DocFast uses minimal technical cookies:
-Your personal data does not leave the European Union. Our infrastructure is hosted exclusively by Hetzner in Germany.
- -For questions about data processing or to exercise your rights:
-Email: privacy@docfast.dev
- Subject: Include "GDPR" in the subject line for priority handling
We will notify users of material changes via email. Continued use of the service constitutes acceptance of updated terms.
-Last updated: February 16, 2026
- -DocFast provides an API service for converting HTML, Markdown, and URLs to PDF documents. The service includes:
-We may terminate accounts for:
-We may update these terms by:
-Questions about these terms:
-