Skip to content

Commit

Permalink
resolves asciidoctor#336 publish examples on Netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Feb 18, 2020
1 parent 716e877 commit 7e85f29
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CONVERTER_FILE = 'lib/asciidoctor-revealjs/converter.rb'
JS_FILE = 'build/asciidoctor-reveal.js'
DIST_FILE = 'dist/main.js'
TEMPLATES_DIR = 'templates'
PUBLIC_DIR = 'public'

file CONVERTER_FILE => FileList["#{TEMPLATES_DIR}/*"] do
build_converter :fast
Expand Down Expand Up @@ -53,6 +54,7 @@ task :build => 'build:converter'

task :clean do
rm_rf CONVERTER_FILE
rm_rf PUBLIC_DIR
end

def build_converter(mode = :pretty)
Expand Down Expand Up @@ -137,6 +139,14 @@ namespace :examples do
`ruby -run -e httpd . -p 5000 -b 127.0.0.1`
end
end

task :publish => ['build','examples:convert'] do
Dir.mkdir PUBLIC_DIR
FileUtils.cp 'src/index.html', "#{PUBLIC_DIR}/index.html"
FileUtils.cp 'node_modules/reveal.js' "#{PUBLIC_DIR}/reveal.js"
FileUtils.cp 'examples/release-4.0.html' "#{PUBLIC_DIR}/release-4.0.html"
FileUtils.cp 'examples/release-4.0.css' "#{PUBLIC_DIR}/release-4.0.css"
end
end

task 'test' => 'doctest'
Expand Down
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
publish = "public/"
command = "bundle exec rake examples:publish"
30 changes: 30 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Asciidoctor reveal.js Examples</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title">
Asciidoctor reveal.js Examples
</h1>
<p class="subtitle">
A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in <strong>AsciiDoc</strong>! https://asciidoctor.org
</p>
</div>
</section>
<section>
<div class="container">
<div class="content">
<ul>
<li><a hreaf="./release-4.0.html">Asciidoctor reveal.js 4.0.0</a></li>
</ul>
</div>
</div>
</section>
</body>
</html>

0 comments on commit 7e85f29

Please sign in to comment.