Nift has support for you to optionally add in pre/post build/serve scripts/programs to your websites. Just a few of the things this can be useful for includes integrating with webpack, Babel, npm, Bower, Yeoman, Browserify, Parcel, Brunch, SASS, Grunt, Puppeteer, Python webserver, Live Server, Live Reload, etc.. You can use any scripting or programming language you want, eg. batch, bash shell, C/C++, C#, fish, go, Haskell, Java, Javascript, Objective-C, Perl, PHP, Python, Ruby, Swift, Zsh shell and many more.
Note: Make sure your scripts/programs have executable permissions, otherwise Nift will be unable to run them and should throw a build error.
The script extension for website-wide scripts/programs is specified with
Note: Build/serve scripts/programs are moved to the project root directory to run and by default have a backup copy made. If scripts/programs are so large that copying the file will take time, your site configuration file
Alternatively you can write scripts/programs that you run yourself (not using Nift) which they themselves add the Nift build process in to them, leaving you with just one program that you need to run when building. You will still get to take advantage of Nift's unbeaten build times and powerful template language doing this.
Note: Scripts/programs are run from the project root directory, so all paths in scripts/programs should be starting from that location. Also do not change directory in your scripts/programs as it will mess up the other threads that are also running scripts/programs and/or building pages. If you really must change directories in your scripts/programs then you will have to set the number of build threads to 1 and change back to the project root directory before each script/program ends. Furthermore the output of scripts/programs is not displayed to you when building until after they have finished running, so there is no way to display messages to the user if using user input methods and so are discouraged from being used (plus you would have interference output from other threads), a compromise for much much faster build times (user input is not how you want to be building websites anyway).
Website-wide scripts/programs should reside in the project root directory in a file to be named as follows:
pre-build.scriptExt post-build.scriptExt pre-serve.scriptExt post-serve.scriptExt
Page specific scripts/programs should reside in the same directory as the content file for the page in a file to be named as follows:
pagename-pre-build.scriptExt pagename-post-build.scriptExt
Note: Scripts/programs are run from the project root directory, so all paths in scripts/programs should be starting from that location. Also do not change directory in your scripts/programs as it will mess up the other threads that are also running scripts/programs and/or building pages. If you really must change directories in your scripts/programs then you will have to set the number of build threads to 1 and change back to the project root directory before each script/program ends. Furthermore the output of scripts/programs is not displayed to you when building until after they have finished running, so there is no way to display messages to the user if using user input methods and so are discouraged from being used (plus you would have interference output from other threads), a compromise for much much faster build times (user input is not how you want to be building websites anyway).