all repos — hastysite @ ac1672ec25c82d0bdc737cc747cf50a098ddef27

A high-performance static site generator.

Added site pages; wrote getting started.
h3rald h3rald@h3rald.com
Sat, 11 Nov 2017 18:33:34 +0100
commit

ac1672ec25c82d0bdc737cc747cf50a098ddef27

parent

975afa2d4d031cb3d3763ddc5d4022765ffbc934

M hastysite.nimhastysite.nim

@@ -67,6 +67,8 @@ const STYLE_FONTS = "./site/assets/styles/fonts.css".slurp

const STYLE_HASTYSITE = "./site/assets/styles/hastysite.css".slurp const STYLE_HASTYSCRIBE = "./site/assets/styles/hastyscribe.css".slurp const STYLE_LUXBAR = "./site/assets/styles/luxbar.css".slurp +const STYLE_SITE = "./site/assets/styles/site.css".slurp +const RULES = "./site/rules.min".slurp let PEG_CSS_VAR_DEF = peg"""'--' {[a-zA-Z0-9_-]+} ':' {@} ';'""" let PEG_CSS_VAR_INSTANCE = peg"""

@@ -244,7 +246,7 @@ createDir(dir/"assets/fonts")

createDir(dir/"assets/styles") json["title"] = %"My Web Site" json["rules"] = %"rules.min" - writeFile(dir/json["rules"].getStr, "") + writeFile(dir/"rules.min", RULES) writeFile(dir/"settings.json", json.pretty) writeFile(dir/"scripts/build.min", SCRIPT_BUILD) writeFile(dir/"scripts/clean.min", SCRIPT_CLEAN)

@@ -266,6 +268,7 @@ writeFile(dir/"assets/styles/fonts.css", STYLE_FONTS)

writeFile(dir/"assets/styles/hastyscribe.css", STYLE_HASTYSCRIBE) writeFile(dir/"assets/styles/hastysite.css", STYLE_HASTYSITE) writeFile(dir/"assets/styles/luxbar.css", STYLE_LUXBAR) + writeFile(dir/"assets/styles/site.css", STYLE_SITE) proc wasModified(hs: HastySite, sha1: string, outfile: string): bool = return (not hs.checksums.hasKey(outfile) or hs.checksums[outfile] != %sha1)

@@ -422,7 +425,7 @@ hastysite command

Commands: init - Initializes a new site in the current directory. -""" +""" % [appname, version] if scripts: for key, value in hs.scripts.pairs: text &= " " & key & " - " & value.getStr & "\n"

@@ -430,7 +433,7 @@ text &= """ Options:

-h, --help Print this help -l, --loglevel Sets the log level (one of: debug, info, notice, warn, error, fatal). Default: notice - -v, --version Print the program version""" % [appname, version] + -v, --version Print the program version""" return text let pwd = getCurrentDir()
A site/assets/styles/site.css

@@ -0,0 +1,3 @@

+.unstyled li a::before { + content: none; +}
A site/contents/about.md

@@ -0,0 +1,6 @@

+----- +id: about +title: "About" +content-type: page +----- +
A site/contents/getting-started.md

@@ -0,0 +1,103 @@

+----- +id: getting-started +title: "Getting Started" +content-type: page +----- + +{{version => 0.2.0}} + +## Download + +You can download one of the following pre-built HastySite binaries: + +> %unstyled% +> * {#release||{{version}}||macosx||macOS||x64||apple#} +> * {#release||{{version}}||windows||Windows||x64||windows#} +> * {#release||{{version}}||linux||Linux||x64||linux#} +> * {#release||{{version}}||linux||Linux||x86||linux#} +> * {#release||{{version}}||linux||Linux||arm||linux#} + +{#release -> [](class:$5)[hastysite v$1 for $3 ($4)](https://github.com/h3rald/hastysite/releases/download/v$1/hastysite\_v$1\_$2\_$4.zip) #} + +## Building from Source + +Alternatively, you can build HastySite from source as follows: + +1. Download and install [nim](https://nim-lang.org). +2. Download and build [Nifty](https://github.com/h3rald/nifty), and put the nifty executable somewhere in your [$PATH](class:kwd). +3. Clone the HastySite [repository](https://github.com/h3rald/hastysite). +4. Navigate to the HastySite repository local folder. +5. Run the following command to download HastySite's dependencies. + > %terminal% + > nifty install +7. Run the following command to compile HastySite: + > %terminal% + > nim c -d:release hastysite.nim + +> %tip% +> Tip +> +> You should put the compiled HastySite executable somewhere in yout [$PATH](class:kwd). + +## Running HastySite + +To create a new site, run the following command in an empty directory: + +> %terminal% +> hastysite init + +This will create the following default directory structure: + + +* assets/ — _Your site assets_ + * fonts/ + * styles/ +* contents/ — _Your site contents._ +* output/ — _Your static web site._ +* rules.min — _Rules to process your contents and assets._ +* scripts/ — _Scripts to manage your site._ +* settings.json — _Your site configuration._ +* temp/ — _Temporary files and folders will be placed here._ +* templates/ — _Mustache templates._ + + +> %tip% +> Tip +> +> Default folder paths can be configured in your [settings.json](class:file) file. + +Then, create your first page by running the following command and specifying the page ID and Title: + +> %terminal% +> hastysite page +> ID: home +> Title: Home Page +> \-\-\-\-\- +> id: home +> title: "Home Page" +> content-type: page +> \-\-\-\-\- +> Create page? [yes/no]: y + +Finally, run the following command to generate your site contents (just an empty home page for now) and copy the default assets. + +> %terminal% +> hastysite build +> Preprocessing\.\.\. +> Processing rules\.\.\. +> - Writing file: output/index.html +> - Copying: assets/fonts/SourceSansPro-Regular.woff -> output/fonts/SourceSansPro-Regular.woff +> - Copying: assets/fonts/SourceSansPro-It.woff -> output/fonts/SourceSansPro-It.woff +> - Copying: assets/fonts/fontawesome-webfont.woff -> output/fonts/fontawesome-webfont.woff +> - Copying: assets/fonts/SourceCodePro-Regular.woff -> output/fonts/SourceCodePro-Regular.woff +> - Copying: assets/fonts/SourceSansPro-Bold.woff -> output/fonts/SourceSansPro-Bold.woff +> - Copying: assets/fonts/SourceSansPro-BoldIt.woff -> output/fonts/SourceSansPro-BoldIt.woff +> - Writing file: output/styles/hastysite.css +> - Writing file: output/styles/site.css +> - Writing file: output/styles/luxbar.css +> - Writing file: output/styles/hastyscribe.css +> - Writing file: output/styles/fonts.css +> Postprocessing\.\.\. +> All done. + +That's it! You can view the result by serving the [output](class:dir) directory from any web server.
M site/contents/home.mdsite/contents/home.md

@@ -1,7 +1,20 @@

----- id: "news" content-type: "page" -title: "Home" +title: "Welcome to HastySite" ----- -Content will be added *here*... +HastySite is a minimalist but powerful static site generator written in [Nim](https://nim-lang.org) which aims to be fast at processing content and highly configurable to suit your own needs. + +## Key Features + +> %unstyled% +> * [](class:check) Built-in rich markdown support via [HastyScribe](https://h3rald.com/hastyscribe). +> * [](class:check) Built-in [mustache](https://mustache.github.io/) support for page templates. +> * [](class:check) Limited support for standard [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables). +> * [](class:check) Fully configurable content and asset processing pipeline, using the [min](https://min-lang.org) programming language. +> * [](class:check) Fully configurable script engine and custom script definition, using the [min](https://min-lang.org) programming language. +> * [](class:check) Built-in default stylesheet based on [HastyScribe](https://h3rald.com/hastyscribe). +> * [](class:check) Default scripts and rules to [get started](/getting-started) quickly. + +
A site/contents/reference.md

@@ -0,0 +1,6 @@

+----- +id: reference +title: "Reference" +content-type: page +----- +
A site/contents/usage.md

@@ -0,0 +1,6 @@

+----- +id: usage +title: "Usage" +content-type: page +----- +
M site/rules.minsite/rules.min

@@ -30,7 +30,6 @@ meta /content-type :tpl

meta ( (input-fread @contents meta) (settings /title %site-title) - (settings /description %site-description) (=temp contents temp markdown @contents temp) (contents %contents) (=temp tpl temp mustache @page temp)
M site/scripts/build.minsite/scripts/build.min

@@ -3,7 +3,7 @@ 'hastysite import

"Preprocessing..." notice preprocess -"Processing rules.." notice +"Processing rules..." notice process-rules "Postprocessing..." notice postprocess
M site/scripts/page.minsite/scripts/page.min

@@ -1,3 +1,4 @@

+;Creates a new empty page. "" :ident "" :title false :valid-id
M site/scripts/post.minsite/scripts/post.min

@@ -1,3 +1,4 @@

+;Creates a new empty post. "" :ident "" :title timestamp :ts
M site/settings.jsonsite/settings.json

@@ -6,6 +6,5 @@ "temp": "temp",

"output": "output", "scripts": "scripts", "title": "HastySite", - "description": "A simple but powerful static site generator", "rules": "rules.min" }
M site/templates/_footer.mustachesite/templates/_footer.mustache

@@ -1,5 +1,5 @@

<footer> -<p>&copy; 2017 &mdash; <a href="https://h3rald.com">Fabio Cevasco</a></p> +<p>&copy; 2016&mdash;2017 &mdash; <a href="https://h3rald.com">Fabio Cevasco</a></p> <p> <a href="http://creativecommons.org/licenses/by-sa/4.0/"> <img src="https://img.shields.io/badge/content-CC%20BY--SA%204.0 License-yellow.svg"
M site/templates/_head.mustachesite/templates/_head.mustache

@@ -1,10 +1,11 @@

<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content="{{site-description}}"> + <meta name="description" content="A minimalist but powerful static site generator"> <title>{{site-title}} - {{title}}</title> <link rel="stylesheet" href="/styles/fonts.css"> <link rel="stylesheet" href="/styles/hastyscribe.css"> <link rel="stylesheet" href="/styles/hastysite.css"> <link rel="stylesheet" href="/styles/luxbar.css"> + <link rel="stylesheet" href="/styles/site.css"> </head>