Permalink
Browse files

feature: Partials

  • Loading branch information...
MikeMitterer committed Apr 20, 2015
1 parent 75882d3 commit 8d860a65fe732bb1de1341ea7e95003d2172bb27
View
@@ -1,6 +1,5 @@
# SiteGen
A simple static site generator in [Dart][dart], webserver included.
Now with partials-support. A static site generator in [Dart][dart], webserver included.
You can write your pages in HTML or [Markdown][markdown]. For Templates [Mustache][mustache] is supported.
A webserver for a quick review is included. On Mac you also get automatic page refresh. On other
@@ -107,6 +106,7 @@ Supported vars:
- content_dir: html/_content
- template_dir: html/_templates
- partials_dir: html/_partials
- output_dir: web
- workspace: .
- date_format: dd.MM.yyyy
@@ -115,7 +115,8 @@ Supported vars:
- default_template: default.html
- sasscompiler: sassc
- usesass: true
- useapfx: true
- autoprefixer: true
- browser: Chromium
## Markdown
**SiteGen** lets you use [markdown][markdown] to write your site content. At the beginning of each markdown file, you
@@ -173,6 +174,22 @@ The default template is 'default.html' but you can overwrite this behavior if yo
template: info_page
## Partials
**Optional**
Files / Directories in your _partials-Folder will be translated into partials-names.
For example: _partials/category/house.md translates into {{>category.house}}
A partial can be either a .md or a .html file
You can also use partials in the files yaml block:
```yaml
template: default.html
dart: ->usage.badge.dart
~~~
```
## SASS
If SiteGen finds a .scss file in your output dir (web) it compiles it to the corresponding .css file.
Install instruction for SASS can be found [here][installsass]
@@ -206,25 +223,26 @@ Uninstall
## Usage
```shell
Usage: sitegen [options]
-s, --settings Prints settings
-h, --help Shows this message
-g, --generate Generate site
-w, --watch Observes SRC-dir
-i, --init Initializes your site
(not combinable with other options)
-s, --settings Prints settings
-h, --help Shows this message
-g, --generate Generate site
-w, --watch Observes SRC-dir
-x, --watchandserve Shortcut to watch and serve
-i, --init Initializes your site
(not combinable with other options)
--serve Serves your site
--[no-]usesass Enables / disables SASS to CSS compiler
(defaults to on)
--serve Serves your site
--[no-]usesass Enables / disables SASS to CSS compiler
(defaults to on)
--[no-]useapfx Enables / disables Autoprefixer
(defaults to on)
--[no-]useapfx Enables / disables Autoprefixer
(defaults to on)
--port Sets the port to listen on
(defaults to "8000")
--port Sets the port to listen on
(defaults to "8000")
-v, --loglevel Sets the appropriate loglevel
[info, debug, warning]
-v, --loglevel Sets the appropriate loglevel
[info, debug, warning]
Sample:
@@ -249,6 +267,8 @@ If you are using Chromium on Mac you will get a automatic page refresh for free!
Now play with sitegen and watch my screencast...
Check out the [sample!][sample]
### Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
@@ -287,4 +307,5 @@ or **star** this repo here on GitHub.
[promoimage]: https://github.com/MikeMitterer/dart-sitegen/blob/master/assets/screenshot.jpg?raw=true
[video]: http://goo.gl/uUTg8s
[installsass]: http://sass-lang.com/install
[sample]: https://github.com/MikeMitterer/dart-sitegen/tree/master/example/simple
@@ -0,0 +1,11 @@
tell application "Chrome"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
repeat with atab in tabList
if (URL of atab contains "localhost") then
tell atab to reload
end if
end repeat
end repeat
end tell
@@ -3,4 +3,6 @@
site_options:
name: Mike
site_name: HudriWudri
author: Mike Mitterer
author: Mike Mitterer
browser: Chrome
@@ -10,7 +10,7 @@
</div>
<div class="badge">
<div class="greeting">
Arrr! Me name is
Arrr! Me name is {{> name }}{{>category.house}}
</div>
<div class="name">
<span id="badgeName"> </span>
@@ -0,0 +1,2 @@
## This is my house
and this is my kitchen!
@@ -0,0 +1 @@
<div>This is my name4</div>
@@ -21,7 +21,7 @@ <h2>{{title}}</h2>
<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
{{_content}}
{{> name }}
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
@@ -28,6 +28,7 @@ <h2>Headline II</h2>
<span id="badgeName"> </span>
</div>
</div>
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
@@ -34,6 +34,7 @@ <h2>Families</h2>
</ul>
</li>
</ul>
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
@@ -29,18 +29,21 @@ <h2>Pirate badge1</h2>
</div>
<div class="badge">
<div class="greeting">
Arrr! Me name is
Arrr! Me name is <div>This is my name4</div>
<h2>This is my house</h2>
<p>and this is my kitchen!</p>
</div>
<div class="name">
<span id="badgeName"> </span>
</div>
</div>
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
'date_format' variable.
-->
<span>Last modified: 30.03.2015</span>
<span>Last modified: 20.04.2015</span>
<!-- Values set in 'site.yaml' can be accessed as properties in the '_site' variable -->
by <span>Mike Mitterer</span>
Template: /Volumes/Daten/DevLocal/DevDart/SiteGen/example/simple/html/_templates/default.html
@@ -57,6 +57,7 @@ <h3>Subheadline</h3>
<p>Note how you need to use a <code>.</code> to access a list item, but can access map/dict keys directly.
You can of course disable these markdown templating features by setting <code>markdown_templating: true</code> in your <a href="../site.yaml">site.yaml</a> file.
Same ideas apply when writing your actual HTML templates. See <a href="http://mustache.github.io/mustache.5.html">mustache's docs</a> for more templating info.</p>
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
@@ -1,5 +1,5 @@
body {
background-color: whitesmoke;
background-color: #F8F8F8;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
font-weight: normal;
@@ -50,6 +50,4 @@ h1, p {
margin-left: 0; } }
footer {
padding-top: 24px;
font-weight: bold;
clear: both; }
@@ -28,6 +28,7 @@ <h2>X-Men</h2>
<li>Marvel Girl</li>
<li>Storm</li>
</ul>
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
@@ -20,6 +20,7 @@
<h2>xtreme</h2>
<!-- '_content' contains the contents of the markdown file (minus the yaml variables in the header) -->
<div>This is my name4</div>
<footer>
<!--
'_date' stores the markdown page's last modified date. The date formatting can be set in 'site.yaml' via the
View
@@ -57,6 +57,11 @@ class Application {
if(_isFolderAvailable(config.datafolder)) {
watch(config.datafolder, config);
}
if(_isFolderAvailable(config.partialsfolder)) {
watch(config.partialsfolder, config);
}
new Generator().generate(config);
}
watchScss(config.outputfolder, config);
@@ -233,7 +238,7 @@ class Application {
_logger.fine(result.stdout.trim());
final String content = """
tell application "Chromium"
tell application "${config.browser}"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
@@ -248,7 +253,7 @@ class Application {
final String version = "1.0";
final String executable = "osascript";
final String scriptName = "refreshChromium";
final String scriptName = "refresh${config.browser}";
final String scriptExtension = "applescript";
final Directory contenfolder = new Directory(config.configfolder);
View
@@ -11,6 +11,7 @@ class Config {
static const _CONF_TEMPLATE_DIR = 'template_dir';
static const _CONF_OUTPUT_DIR = 'output_dir';
static const _CONF_DATA_DIR = 'data_dir';
static const _CONF_PARTIALS_DIR = 'partials_dir';
static const _CONF_WORKSPACE_DIR = 'workspace';
static const _CONF_DATE_FORMAT = 'date_format';
static const _CONF_YAML_DELIMITER = 'yaml_delimeter';
@@ -20,6 +21,7 @@ class Config {
static const _CONF_SASS_COMPILER = 'sasscompiler';
static const _CONF_USE_SASS = 'usesass';
static const _CONF_USE_AUTOPREFIXER = 'autoprefixer';
static const _CONF_BROWSER = 'browser';
final ArgResults _argResults;
final Map<String,dynamic> _settings = new Map<String,dynamic>();
@@ -31,13 +33,15 @@ class Config {
_settings[Config._CONF_CONTENT_DIR] = 'html/_content';
_settings[Config._CONF_TEMPLATE_DIR] = 'html/_templates';
_settings[Config._CONF_DATA_DIR] = 'html/_data';
_settings[Config._CONF_PARTIALS_DIR] = 'html/_partials';
_settings[Config._CONF_OUTPUT_DIR] = 'web';
_settings[Config._CONF_WORKSPACE_DIR] = '.';
_settings[Config._CONF_DATE_FORMAT] = 'dd.MM.yyyy';
_settings[Config._CONF_YAML_DELIMITER] = '~~~';
_settings[Config._CONF_USE_MARKDOWN] = true;
_settings[Config._CONF_DEFAULT_TEMPLATE] = "default.html";
_settings[Config._CONF_SASS_COMPILER] = "sassc";
_settings[Config._CONF_BROWSER] = "Chromium";
_settings[Config._CONF_SITE_OPTIONS] = {};
@@ -68,6 +72,8 @@ class Config {
String get datafolder => _settings[Config._CONF_DATA_DIR];
String get partialsfolder => _settings[Config._CONF_PARTIALS_DIR];
String get workspace => _settings[Config._CONF_WORKSPACE_DIR];
String get dateformat => _settings[Config._CONF_DATE_FORMAT];
@@ -88,6 +94,7 @@ class Config {
bool get useautoprefixer => _settings[Config._CONF_USE_AUTOPREFIXER];
String get browser => _settings[Config._CONF_BROWSER];
Map<String,String> get settings {
final Map<String,String> settings = new Map<String,String>();
@@ -97,6 +104,7 @@ class Config {
settings["Content folder"] = contentfolder;
settings["Template folder"] = templatefolder;
settings["Data folder"] = datafolder;
settings["Partials folder"] = partialsfolder;
settings["Default template"] = defaulttemplate;
settings["Output folder"] = outputfolder;
@@ -115,6 +123,7 @@ class Config {
settings["Config file"] = configfile;
settings["SASS compiler"] = sasscompiler;
settings["Browser"] = browser;
settings["Port"] = port;
Oops, something went wrong.

0 comments on commit 8d860a6

Please sign in to comment.