Skip to content

Commit

Permalink
Vendor external dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Jan 7, 2021
1 parent 4f98421 commit dc8f0c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ release ?=

md_files = $(wildcard *.md)
html_files := $(md_files:.md=.html)
vendored_files := github-markdown.min.css

nightly_link: nightly_link.cr $(wildcard *.cr) $(html_files) $(wildcard templates/*.html)
nightly_link: nightly_link.cr $(wildcard *.cr) $(html_files) $(wildcard templates/*.html) $(vendored_files)
$(CRYSTAL) build $(if $(release),--release )$<

render_md: render_md.cr
Expand All @@ -13,6 +14,9 @@ render_md: render_md.cr
%.html: %.md render_md
./render_md $< > $@

github-markdown.min.css:
curl -O https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css

.PHONY: clean
clean:
rm -f $(html_files) render_md nightly_link
Expand Down
10 changes: 10 additions & 0 deletions nightly_link.cr
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,14 @@ class ArtifactsController < ART::Controller
end
end

class StaticController < ART::Controller
@[ART::Get(path: "/github-markdown.min.css")]
def css : ART::Response
ART::Response.new(
{{read_file("#{__DIR__}/github-markdown.min.css")}},
headers: HTTP::Headers{"content-type" => MIME.from_extension(".css")}
)
end
end

ART.run(host: "127.0.0.1", port: PORT)
2 changes: 1 addition & 1 deletion templates/head.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css">
<link rel="stylesheet" href="/github-markdown.min.css?4.0.0">
<style>
.markdown-body {
box-sizing: border-box;
Expand Down

0 comments on commit dc8f0c3

Please sign in to comment.