Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Hi
Browse files Browse the repository at this point in the history
  • Loading branch information
holzmaster committed Apr 28, 2020
0 parents commit 0b82eff
Show file tree
Hide file tree
Showing 20 changed files with 1,527 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
indent_size = 4
indent_style = tab

[{package,package-lock}.json]
indent_size = 2
indent_style = space

[*.yml]
indent_size = 2
indent_style = space

[*.svg]
insert_final_newline = false
72 changes: 72 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Pages

on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Use Node.js 13.2
uses: actions/setup-node@v1
with:
node-version: 13.2

- name: npm install, build, and test
run: |
npm ci
npm run build-docs
env:
CI: true

- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: build

- name: Create Release
id: create_release
uses: actions/create-release@latest
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload minified CSS
uses: actions/upload-release-asset@v1
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/pr0gramm.min.css
asset_name: pr0gramm.min.css
asset_content_type: text/css

- name: Upload CSS
uses: actions/upload-release-asset@v1
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/pr0gramm.css
asset_name: pr0gramm.css
asset_content_type: text/css

- name: Publish Package
if: startsWith(github.ref, 'refs/tags/v')
run: |
npm ci
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
node_modules/
*.css
*.map
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.js
*.scss
*.html
*.map
.*ignore
.github
.editorconfig
build
src
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pr0gramm.css

Ein Stylesheet für pr0gramm-esque Seiten.

Dieses Stylesheet hat nichts mit dem offiziellen Stylesheet von pr0gramm zu tun.

### [Dokumentation](https://holzmaster.github.io/pr0gramm.css)
32 changes: 32 additions & 0 deletions build-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const fs = require("fs");
const hljs = require("highlightjs");
const child_process = require("child_process");
const outdent = require("outdent");

console.log("Bundling CSS...");
const npmOutput = child_process.execSync("npm run compile:prod", { encoding: "utf-8" });
console.log(npmOutput);

const indexTemplate = fs.readFileSync("index.html", { encoding: "utf-8" });

console.log("Replacing variables...");

const correctedCss = indexTemplate
.replace("build/pr0gramm.css", "pr0gramm.min.css")
.replace("node_modules/highlightjs/styles/vs2015.css", "vs2015.css");

console.log("Highlighting code...");

const demoPattern = /\{\{(.+?);\n*(.+?)\n*\}\}/gis;

const withDemoCode = correctedCss.replace(demoPattern, (_, language, codeToHighlight) => {
const normalizedCode = outdent.string(codeToHighlight).trim();
return hljs.highlight(language, normalizedCode).value;
});

console.log("Writing out files...");

fs.copyFileSync("node_modules/highlightjs/styles/vs2015.css", "build/vs2015.css");
fs.writeFileSync("build/index.html", withDemoCode);

console.log("...done!");
Loading

0 comments on commit 0b82eff

Please sign in to comment.