{"id":29623857,"url":"https://github.com/mikemitterer/dart-sitegen","last_synced_at":"2025-07-21T05:08:14.069Z","repository":{"id":29566155,"uuid":"33105558","full_name":"MikeMitterer/dart-sitegen","owner":"MikeMitterer","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-05T22:37:24.000Z","size":368,"stargazers_count":41,"open_issues_count":12,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-16T06:44:23.553Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MikeMitterer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-30T05:47:25.000Z","updated_at":"2023-07-24T05:54:16.000Z","dependencies_parsed_at":"2022-09-03T18:01:36.459Z","dependency_job_id":null,"html_url":"https://github.com/MikeMitterer/dart-sitegen","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/MikeMitterer/dart-sitegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMitterer%2Fdart-sitegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMitterer%2Fdart-sitegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMitterer%2Fdart-sitegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMitterer%2Fdart-sitegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeMitterer","download_url":"https://codeload.github.com/MikeMitterer/dart-sitegen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeMitterer%2Fdart-sitegen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266242072,"owners_count":23898102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-21T05:08:13.534Z","updated_at":"2025-07-21T05:08:14.064Z","avatar_url":"https://github.com/MikeMitterer.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SiteGen \n\u003e Static site generator. Includes a webserver, sass + autoprefix support  \n\u003e Wants to be Jekyll for Dart \n\nBefore you read on - check out this [video](https://www.youtube.com/watch?v=smf1uvy0yNQ):\n\n[![ScreenShot](https://github.com/MikeMitterer/dart-sitegen/blob/master/assets/screenshot.jpg?raw=true)](https://www.youtube.com/watch?v=smf1uvy0yNQ)\n\n## Example\n\n   - Install SiteGen `pub global activate sitegen`\n   - Clone the example from `https://github.com/MikeMitterer/dart-sitegen/tree/master/samples/simple`\n   - run `sitegen -w` \n   - open another console window and run `pub run build_runner serve --delete-conflicting-outputs --live-reload`\n\nPlay with the sample files...\n     \n#### Support for https-connection! \nThis is absolutely mandatory if your REST-Server\nuses [HTTP Strict Transport Security (HSTS)](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security)\n\n[Here](https://github.com/MikeMitterer/dart-sitegen/blob/master/samples/simple/.sitegen/site.yaml) \nyou can see the necessary configuration for HTTPS-Support   \nGenerate a self-signed certificate, name it dart.cert and dart.key, place it under \u003cproject root\u003e/etc \nand run `sitegen -x --usesec` and - voila. That's it!\n\n#### Support for SASS_PATH\n[Understanding and Using Sass Load Paths](http://technology.customink.com/blog/2014/10/09/understanding-and-using-sass-load-paths/)   \n\nThese settings in your .sitegen/site.yaml ()\n```yaml\n    sasscompiler: sass\n    sass_path:\n      - \"package:zengen\"\n      - \"package:mdl\"\n```\n\ngenerate generate the following SASS_PATH:\n```bash\nsitegen -s\n\n    Settings:\n        Loglevel:                  info\n        ...\n        SASS compiler:             sass\n        SASS_PATH (only for sass): /Users/mikemitterer/.pub-cache/hosted/pub.dartlang.org/zengen-0.3.2/lib\n                                   /Volumes/Daten/DevLocal/DevDart/MaterialDesignLite/lib\n        ...\n\n```\nAs you can see the first path is resolved to .pub-cache, the second path\nis resolve to my local working dir where the mdl-library resides\n\nNow you can define your SASS-Import as follows:\n```scss\n    // Imports package:mdl/lib/assets/styles/button/variables\n    @import \"assets/styles/button/variables\";\n```\n\n### What it does\nSiteGen is a static site generator in [Dart](https://www.dartlang.org/), webserver included.\nWith extra assets-folder and partials-support.  \nYou can write your pages in HTML or [Markdown](http://daringfireball.net/projects/markdown/syntax). \nFor Templates [Mustache](http://mustache.github.io/mustache.5.html) is supported.\n  \nA webserver for a quick review is included. On Mac you also get automatic page refresh. On other \nplatforms you could try [LivePage](https://chrome.google.com/webstore/detail/livepage/pilnojpmdoofaelbinaeodfpjheijkbh) \nchrome extension for maximum productivity.  \n\n[Here](https://github.com/MikeMitterer/dart-sitegen/tree/master/sample/simple) you can see a typical site structure.\n\nUnder [sitegen.mikemitterer.at](http://sitegen.mikemitterer.at) you can see the result!   \n\nCheck out the [sample!](https://github.com/MikeMitterer/dart-sitegen/tree/master/samples/simple) or\n[download](https://github.com/MikeMitterer/dart-sitegen/blob/master/downloads/simple.tgz) the sample as .TGZ.\n\n```\n├── .sitegen\n│   ├── html\n│   │   ├── _content\n│   │   │   ├── about\n│   │   │   │   └── index.html\n│   │   │   ├── assets\n│   │   │   │   ├── images\n│   │   │   │   │   ├── android-desktop.png\n│   │   │   │   │   ├── favicon.png\n│   │   │   │   │   └── ios-desktop.png\n│   │   │   │   └── styles\n│   │   │   │       └── styles.scss\n│   │   │   ├── features.html\n│   │   │   ├── index.html\n│   │   │   ├── main.dart\n│   │   │   ├── markdown.md\n│   │   │   ├── special\n│   │   │   │   ├── template.html\n│   │   │   │   └── xtreme.html\n│   │   │   └── technology.html\n│   │   ├── _data\n│   │   │   ├── families.json\n│   │   │   ├── menu.json\n│   │   │   └── xmen.yaml\n│   │   ├── _partials\n│   │   │   ├── cards\n│   │   │   │   └── wide.html\n│   │   │   └── header.html\n│   │   └── _templates\n│   │       ├── default.html\n│   │       └── info_page.html\n│   ├── refreshChrome-1.0.applescript\n│   ├── refreshChromium-1.0.applescript\n│   ├── refreshDartium-1.0.applescript\n│   └── site.yaml\n├── pubspec.yaml\n└── web\n    ├── about\n    │   └── index.html\n    ├── assets\n    │   ├── images\n    │   │   ├── android-desktop.png\n    │   │   ├── favicon.png\n    │   │   └── ios-desktop.png\n    │   └── styles\n    │       ├── styles.css\n    │       └── styles.scss\n    ├── features.html\n    ├── index.html\n    ├── main.dart\n    ├── markdown.html\n    ├── special\n    │   ├── template.html\n    │   └── xtreme.html\n    └── technology.html\n```\n\n**.sitegen**: This is where your (optional) site.yaml lives  \nThis folder is also used to store autgenerated scripts - in the case above you can see\nthe script to refresh Chromium on Mac.\n\n**.sitegen/html/_content**: This is where **SiteGen** will look for your files to generate the site from.\nThe following file-formats are supported:\n\n- .md\n- .markdown\n- .dart\n- .js\n- .json\n- .html\n- .scss\n- .css\n\n**.sitegen/html/_data**: [optional] This is the place where you can store your data-files.  \nThe following file-formats are supported:\n\n- .yaml\n- .json\n\n**SiteGen** injects your data into a global _data variable.\nHere is a sample how to use such data:\n  \n```html\n\u003cul\u003e\n    {{#_data.xmen}}\n    \u003cli\u003e{{.}}\u003c/li\u003e\n    {{/_data.xmen}}\n\u003c/ul\u003e\n```\n\n**.sitegen/html/_assets**: [optional] Additional assets that you don't want to have in _content. For example .scss \nor .jpg files.\n\n**.sitegen/html/_templates**: The directory containing your HTML+Mustache templates.\n\n**web**: Following Dart conventions - this is your default output directory.\n\n## site.yaml\n**Optional** [YAML](http://rhnh.net/2011/01/31/yaml-tutorial) file that stores your global values and config options.\nValues set here can be accessed from all templates and markdown files.\n\n```\nsite_options:\n  author: Mike Mitterer\n```\n\nCan be used in your template (default.html) as\n```\n\u003cspan\u003e{{_site.author}}\u003c/span\u003e\n```\n\nYou can also use site.yaml to overwrite your **SiteGen** default configuration.  \nSupported vars:\n\n- content_dir: .sitegen/html/_content \n- template_dir: .sitegen/html/_templates\n- data_dir: .sitegen/html/_data\n- partials_dir: .sitegen/html/_partials\n- assets_dir: .sitegen/html/_assets\n- output_dir: web\n- workspace: .\n- date_format: dd.MM.yyyy\n- yaml_delimeter: ~~~\n- use_markdown: true\n- default_template: default.html\n- sasscompiler: sassc\n- usesass: true\n- autoprefixer: true\n- browser: Chromium\n- talktome: true (on OSX, false on all the other OSs)\n- watchfolder1, watchfolder2 and watchfolder3\n\n## Markdown\n**SiteGen** lets you use [markdown](http://daringfireball.net/projects/markdown/syntax) to write your site content. At the beginning of each markdown file, you\nhave the option to use a [YAML](http://rhnh.net/2011/01/31/yaml-tutorial) block to define custom values that you can inject into your templates. Example:\n\n    title: A Blog Post\n    published: 01/01/2014\n    category: example\n    tags:\n        - StillShot\n        - Rants\n        - Etc.\n    ~~~~~~\n    {{title}}\n    Normal Markdown content here...\n\nAs you can see, a line of tildes (`~`) is used to designate your YAML block. You can access/inject your values into\nyour pages using [mustache template syntax](http://mustache.github.io/mustache.5.html). You can do this either inside your dedicated HTML/mustache templates:\n\n    \u003cul\u003e\n      {{#tags}}\n        \u003cli\u003e{{.}}\u003c/li\u003e\n      {{/tags}}\n    \u003c/ul\u003e\n\nOr, you can embed your values within the markdown file itself:\n\n    {{#tags}}\n      - __{{.}}__\n    {{/tags}}\n\nso you can take advantage of templating and markdown at the same time.\n\nSimply place all your files in your `content_dir` and **SiteGen** will generate your site accordingly.      \nIf your markdown file has a .md extension it will be renamed to .html.\n    \n## Templates\nAs mentioned above, you can access any variables set within your markdown files from your templates using mustache. Options\nset from your `site.yaml / site_options` can be accessed through the `_site` variable, like so:\n\n    \u003ch1\u003e{{ _site.author}}\u003c/h1\u003e\n\nwhere `author` is a property defined in your `site.yaml / site_options`. \nYou can access these values from your markdown or from your html files.\n\nEvery page and template has access to the following values:\n\n- `title`: title, usually set inside each markdown file, but is set to the name of markdown file if left blank\n- `_site`: site.yaml values\n- `_date`: the post/markdown file's _last modified_ date\n- `_content`: converted markdown content (only accessible from templates)\n- `_page.relative_to_root`: will be replaced with some '../' depending on the nesting level of your page (check about/index.html)\n    \nThe default template is 'default.html' but you can overwrite this behavior if you add a 'template' var to the yaml-block of your content file.\n\n    template: info_page\n    \n    \n## Partials \n**Optional**  \nFiles / Directories in your _partials-Folder will be translated into partials-names.  \nFor example: _partials/category/house.md translates into {{\u003ecategory.house}}  \nA partial can be either a .md or a .html file\n\nYou can also use partials in the files yaml block:\n```yaml\ntemplate: default.html    \ndart: -\u003eusage.badge.dart  \n~~~  \n```\n\n## SASS\nIf SiteGen finds a .scss file in your output dir (web) it compiles it to the corresponding .css file.      \nInstall instruction for SASS can be found [here](http://sass-lang.com/install)  \nIn short it's `gem install sass` and `gem install sassc`  \n\nYou can turn off SASS either with `--no-usesass` or with the appropriate setting in site.yaml \n\nOr - event better, **install sassc**: `brew install sassc`\n\n## Autoprefixer\nAfter compiling .SCSS to .CSS SiteGen calls autoprefixer \u003cyourcss\u003e  \nInstall autoprefixer with `npm install --global autoprefixer-cli`\n\nYou can turn off Autoprefixer either with `--no-useapfx` or with the appropriate setting in site.yaml \n    \n# Install\nInstall\n```shell\n    pub global activate sitegen\n```\n\nUpdate\n```shell\n    # activate sitegen again\n    pub global activate sitegen\n```\n\nUninstall\n```shell\n    pub global deactivate sitegen   \n```    \n    \n## Usage    \n```shell\nUsage: sitegen [options]\n    -s, --settings         Prints settings\n    -h, --help             Shows this message\n    -g, --generate         Generate site\n    -c, --generatecss      Generate CSS (compile SCSS2CSS)\n    -w, --watch            Observes SRC-dir\n    -x, --watchandserve    Shortcut to watch and serve\n    -i, --init             Initializes your site\n                           (not combinable with other options)\n\n        --serve            Serves your site\n        --[no-]usesass     Enables / disables SASS to CSS compiler\n                           (defaults to on)\n\n        --[no-]useapfx     Enables / disables Autoprefixer\n                           (defaults to on)\n\n        --[no-]talktome    Enables / disables Speek-Output\n                           (defaults to on)\n\n        --ip               Sets the IP-Address to listen on\n                           (defaults to \"127.0.0.1\")\n\n        --port             Sets the port to listen on\n                           (defaults to \"8000\")\n\n        --docroot          Document root\n                           (defaults to \"web\")\n\n    -v, --loglevel         Sets the appropriate loglevel\n                           [info, debug, warning]\n\nSample:\n\n    'Generates all basic files and folders:                'sitegen -i'\n    'Observes the default dirs and serves the web-folder:  'sitegen -w --serve'\n    'Observes the default dirs and serves the web-folder:  'sitegen -x'\n    'Generates the static site in your 'web-folder':       'sitegen -g'\n```\n\nGo to your project root (this is where your pubspec.yaml is) and type:\n\n    sitegen -i\n    \nThis creates a basic file structure for you.     \n\nNow type\n\n    sitegen -w --serve\n    \nThis servers your files under http://localhost:8000/    \n        \nIf you are using Chromium on Mac you will get a automatic page refresh for free!\n \n## Hints\n- Just serve a local dir on port 8000 without generating something:  \n    `sitegen --serve --docroot .`\n    \n- Sitegen observes automatically it's basefolders like content, web aso. but if\n    you want additional folders that should be observed so that sitegen automatically regenerates it's\n    file - set watchfolder[1-3] in you site.yaml\n    \n- Test your App with Chrome and use sitegen as server (MAC + Linux only)  \n    `pub build \u0026\u0026 cd build/web \u0026\u0026 sitegen --serve --port 9000 --docroot . || cd -`\n    \n    *Explanation:*  \n    Runs \"pub build\" - if this runs without errors cd to \"build/web\"\n    In \"build/web\" run sitegen as server on port 9000 and set docroot to . (current dir (default would be \"web\"))  \n    || means if the prev command ends with an error (Ctrl + C to cancel sitegen)   \n    jump back where you came from. You should be back in your base folder (where your pubspec.yaml is)\n    \n \n\n### Features and bugs\nPlease file feature requests and bugs at the [issue tracker](https://github.com/MikeMitterer/dart-sitegen/issues).\n\n### Thanks\nI want to thank \"Enrique Gavidia\" for his [stillshot](https://pub.dartlang.org/packages/stillshot) \npackage that I used as basis for **SiteGen**. \n\n### License\n\n    Copyright 2019 Michael Mitterer (office@mikemitterer.at),\n    IT-Consulting and Development Limited, Austrian Branch\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\n    either express or implied. See the License for the specific language\n    governing permissions and limitations under the License.\n\n\nIf this plugin is helpful for you - please [(Circle)](http://gplus.mikemitterer.at/) me\nor **star** this repo here on GitHub.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikemitterer%2Fdart-sitegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikemitterer%2Fdart-sitegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikemitterer%2Fdart-sitegen/lists"}