2015-11-13
LitePub has a built-in server so you can see how a generated blog looks like in a browser. cd
to the blog's directory and start the server:
$ litepub serve
Running on http://localhost:2703
Ctrl+C to quit
Now open http://localhost:2703 in your browser to see the generated blog.
Note that the server ignores the draft posts.
When starting the server you can specify a port on which to listen with the --port
option:
$ litepub serve --port 3000
Running on http://localhost:3000
Ctrl+C to quit
When creating templates or even writing posts it's quite useful to be able to immediately see the changes after refreshing the page. To tell LitePub that it should watch for changes to posts and templates use the --watch
option:
$ litepub serve --watch
Running on http://localhost:2703
Rebuilding when posts or templates change
Ctrl+C to quit
Note that subdirectories in the
posts
andtemplates
directories aren't watched.
Sometimes it can be useful to rebuild a blog before serving it, for example when you don't remember if you made any changes to posts or templates. To rebuild a blog before serving use the --rebuild
option:
$ litepub serve --rebuild
Generating: index.html
Generating: tags/reference.html
Generating: tags/tutorial.html
Generating: tags/advanced.html
Generating: tags/docs.html
Generating: tags/basics.html
Generating: overview.html
Generating: quick-start.html
Generating: installation.html
Generating: creating-a-blog.html
Generating: creating-posts.html
Generating: generating-html-files-for-a-blog-aka-building-a-blog.html
Generating: serving-a-blog.html
Generating: templates.html
Generating: getting-help.html
Running on http://localhost:2703
Ctrl+C to quit
Usage:
litepub serve [<dir>] [-R, --rebuild] [-p, --port <port>] [-w, --watch] [-q, --quiet]
Arguments:
<dir> The directory to create the blog in or look for; it will be created if
it doesn't exist (only when creating a blog) [default: .]
Options:
-R, --rebuild Rebuild the blog before serving
-p, --port <port> The port to listen on [default: 2703]
-w, --watch Rebuild the blog when posts or templates change
-q, --quiet Show only errors
Next: Templates
Hi, i'm and this is my place.
This is my picture:
I'm a web developer. I like Ruby the most but i'm fine with other technology also. After all, it's just technology.
I work at topmonks.com. I also have my own tiny company Imagine Anything.
One of my side projects is DameData.cz. It's a web app which helps you to easily connect your business with accounting(czech market only right now). Check it out:
Have a good one
Follow