summaryrefslogtreecommitdiffhomepage
path: root/template
diff options
context:
space:
mode:
Diffstat (limited to 'template')
-rw-r--r--template/Rakefile21
-rw-r--r--template/src/index.html.rb12
-rw-r--r--template/src/script.js.rb13
-rw-r--r--template/src/style.css.rb13
4 files changed, 59 insertions, 0 deletions
diff --git a/template/Rakefile b/template/Rakefile
new file mode 100644
index 0000000..1629ff0
--- /dev/null
+++ b/template/Rakefile
@@ -0,0 +1,21 @@
+require 'Justicar'
+require 'opal-browser'
+
+desc "Build your website"
+task :build do
+ Justicar.build_source('src')
+ Justicar.build('build', 'public')
+end
+
+desc "Create a server and open your site in your browser"
+task :serve do
+ link = "http://localhost:8000/index.html"
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
+ system "start #{link}"
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
+ system "open #{link}"
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
+ system "xdg-open #{link}"
+ end
+ `ruby -run -ehttpd build -p8000`
+end
diff --git a/template/src/index.html.rb b/template/src/index.html.rb
new file mode 100644
index 0000000..cefcf6f
--- /dev/null
+++ b/template/src/index.html.rb
@@ -0,0 +1,12 @@
+Paggio.html do
+ script type: "text/javascript", src: "script.js"
+ link rel: "stylesheet", href: "style.css"
+ h1 { "Hello world from Justicar" }
+ hr
+ h2.paggio do
+ 'Hello world from Paggio!'
+ end
+ p.paggio do
+ "This part was generated by Paggio in HTML :)"
+ end
+end
diff --git a/template/src/script.js.rb b/template/src/script.js.rb
new file mode 100644
index 0000000..0be5ef5
--- /dev/null
+++ b/template/src/script.js.rb
@@ -0,0 +1,13 @@
+require 'opal'
+require 'native'
+require 'promise'
+require 'browser/setup/full'
+
+$document.ready do
+ DOM do
+ h2.opal do
+ "Hello World from Opal!"
+ end
+ p.opal {"This part was generated by Opal from Javascript (:"}
+ end.append_to($document.body)
+end
diff --git a/template/src/style.css.rb b/template/src/style.css.rb
new file mode 100644
index 0000000..d9684e3
--- /dev/null
+++ b/template/src/style.css.rb
@@ -0,0 +1,13 @@
+Paggio.css do
+ rule '.opal' do
+ color :dodgerblue
+ end
+
+ rule '.paggio' do
+ color :goldenrod
+ end
+
+ rule 'h1' do
+ font style: :italic
+ end
+end