cmd: build-auto
[contents]

Contents

Syntax

The syntax for the build-auto command is:

nift build-auto (sleep-sec)
nsm build-auto (sleep-sec)

Description

The build-auto command is for auto building a project locally (automatically building updates to the project without having to manually run a build command), it either takes zero paremters and sleeps for 0.3s between running incremental builds, or takes a single floating point parameter which should be the number of seconds to sleep between running incremental builds.

Note: If your updates are not appearing upon refresh or reload of the output file there's a chance the builds are failing, try checking the .build-auto-log.txt file in the project root directory.

On linux you can also run nsm build-auto -s & to auto build in the background then to stop run killall nsm. Then you can open the webpages/output files in the output directory and Nift will automatically build the project in the background, picking up any changes, just reload your browser window or reload the output file in your editor (often they will pop up a dialogue saying the file has been changed and asking whether you would like to reload).

If you would like your website to be served at an IP address, eg. if you are using Nift on a server or a virtual machine, try using Python (there are also options available through npm). Run either of the following in the project root directory for a url similar to 0.0.0.0:8000/site and from the site directory for a url similar to 0.0.0.0:8000.

python3 -m http.server 8000
python -m SimpleHTTPServer

If you want live reloading for a website check out Live Server which you can get from npm, or Live Reload. In either case you can add them to pre/post build-auto scripts for your website so that it is all integrated in to the Nift serve command and requires no manual effort on your part.

Example

Example of build-auto being used:

nift build-auto
nsm build-auto 1.5