Command Line Options

Documentation of command line options available in Bestatic



This page lists and delineates all the command line options that Bestatic can process. You can view a list by typing bestatic -h on terminal.


Positional arguments


Add bestatic before each of these arguments.

Name of the Argument for bestatic Description of action
version Prints the currently installed version of bestatic and exits.
quickstart Creates a minimal bestatic.yaml file by accepting user input, creates two pages and two posts, and finally build the website in _output directory.

Note: If a proper theme is not present in themes folder, then bestatic quickstart will not be able to generate a website.
newpage filepath This will create a new page file at filepath location. The ".md" extension will be added automatically.

For example, bestatic newpage testpage1 will create testpage1.md within ./pages folder. On the other hand, bestatic newpage sub/directory/testpage2 will create testpage2.md at the ./pages/sub/directory folder. All the subdirectories will be generated automatically.
newpost filepath This will create a new post file at filepath location. The ".md" extension will be added automatically.

For example, bestatic newpost testpost1 will create testpost1.md within ./posts folder. On the other hand, bestatic newpost sub/directory/testpost2 will create testpost2.md at the ./pages/sub/directory folder. All the subdirectories will be generated automatically.
generator (or no argument, i.e., just bestatic command) This is the default action. If everything is in order in current working directory, bestatic will build your website into _output directory (which can be changed; see below for details).

If bestatic.yaml file or themes directory is not present (or does not have a proper theme) in current working directory, bestatic prints that message.

This command should be used to build the final version of the website (either locally or on cloud).



Flags or Options


Add bestatic before each of these flags.

Shorter version Longer version Description of action
-h --help Prints the help message and exit. This should not be used with any positional arguments or flags.
-d DIRECTORY --directory DIRECTORY If DIRECTORY is specified, the final servable version of the website will be available in ./DIRECTORY folder, instead of ./_output folder.
-t THEME --theme THEME This can be used to specify the theme to be used to build the website. Make sure that the theme you are supplying here in the command line is actually present in the ./themes folder. If nothing is specified, bestatic will use the 'Amazing' theme, provided it is there in the themes directory. Note that theme can also be specified in the bestatic.yaml file.
-s --serve This can be used to start the bestatic server right after the build is complete. You can visit https://localhost:8080 to view the live version of your webpage locally.
-a --autoreload When '-a' or '--autoreload' is specified, bestatic will watch the current directory recursively for any changes in files and if there are any changes, then will automatically rebuild the website. This flag is used in conjunction with -s (--serve) flag. You can also include -d (--directory) flag or -t (--theme) flag with it as well.

For example, use bestatic -sa, make changes in files, save them, and reload https://localhost:8080 to see your changes in action live (no need to run bestatic again).
-n PORT --portnumber PORT (New in v0.0.36) This flag allows you to specify a custom port number for the local development server when using the -s or --serve option. By default, Bestatic serves the website on port 8080. You can change this by providing a different port number with this flag.

For example, to serve the website on port 9999 (with autoreload enabled), you can use: bestatic -san 9999 or bestatic --serve --autoreload --portnumber 9999.

Note: Use port number greater than 1024, if you are not running the server as root. Also, the highest port number you can use is 65535.
-p --projectsite (New in v0.0.30) This flag is used when deploying to GitHub Pages Project Sites or GitLab Pages Project Sites. It ensures that all asset links (CSS, JS, images) are properly prefixed with the project name so they work correctly when deployed to a subpath (e.g., https://username.github.io/projectname/). See the deployment documentation for more details.