DSW (Dan's Suckless Webframework, or another acronym you like more) is a static website generator. From a bunch of files and directories it generates a static web site that mirrors the source and adds css/ and and images/ directories.
It's not a new idea, I know, but I didn't like similar programs out there that I tried so I coded this new one.
Very similars scripts from which I have stolen many ideas are sw and rawk and an old version of sw modified by me but not in the public domain (too much bloated!). The appereance is literally grabbed from that of suckless site.
USAGE
-----
dsw build -- builds the static site in htdocs/
dsw news -- build only files changed from last build
dsw page filename -- builds a single page from a file in content/ to stdout
dsw init -- initialize a new project directory here in $PWD
dsw reset -- resets time of generated site to an old value
dsw tpl -- generates a skel.css file, header and footer templates
------
Call the script always from base root of project directory!
- Make a dir for a site project and go there. You always have to run
dsw
from there! - The command
dsw init
creates a dir for text files (content
) and for static site (htdocs
) It creates also an empty css file, an header and footer template, animages
andcss
directory inhtdocs
. Creates a standarddsw.conf
. - Write some text files and directories in
content
with this advice: every directory must have and index file. Main directories incontent
are thougth like "sections" of site and appear in a menu in every page of the site. Change title and subtitle of your site indsw.conf
. - The markup of text files is what you like more (markdown,
txt2tags, html and so on -- or none): you must have the parser to
generate html snippets from them and you must configure the appropriate variable
in dsw.conf:
markhandler
. The parser must read from stdin and write to stdout (I personally use pandoc). Thefext
variable defines the extension of text filenames: only them will be parse by the script. It must have a dot! Like: `fext=".md". - If you link local images put them by hand in htdocs/images directory and link them from the text file.
- For starting to styling your site you can initially use the standard
default.css
file from the distribution. - Run
dsw build
from the project directory and you'll obtain the site inhtdocs
. The script appends also to the filelastgen.time
the time of generation. The next time you'll build the site you can choice to rebuild all site with the same commanddsw build
or only the modified files with commanddsw news
. WARNING! Make this last choice only if you are sure to have modified existing files without having added/deleted directories or files (on the contrary the old html files not rebuilded will have menu and navbar not updated!).dsw news
is useful if you want to rebuild some pages immediately after you make changes in some existing files. In all other cases usedsw build
. With commanddsw reset
you delete the content of filelastgen.time
and set its modification time to and old basic value (2001-01-01). - To test the site go in
htdocs
, start the simple python webserver with the commandpython -m SimpleHTTPServer
and from the browser visitlocalhost:8000
- Navigating the site is simple. The name of the files and directories are the name of links that link to them: so is better for those names to be short and expressive!