Building process for minify and rsync, scp

Im looking to add a few commands to the final build process. One is pre final build – minifying js and css. The other is post-build – rsync or scp the public folder to a remote machine.

Is there a method for spawning a console command in the process. Makefile,Bash or whatever is needed

Oh perhaps this will work adequately for the second rsync command.!

$ zola serve --interface --port 2000 --output-dir www/public

I do not believe so, I asked about this in the past, you can see how I handle minification in the Abridge theme if it helps. I basically put my minification commands into an npm script (package.json).

The npm script handles minification as well as bundling js files, etc.

I had planned to make a more dynamic way of specifying which features to include, you can see there are a lot of different npm scripts that can be ran within the package.json, this is to support different options and combinations of the theme. I think some sort of option matrix would be better, where I have a list of features that can be set to true or false, and the script takes it from there, but for my purposes it works for now. I am far to busy at the moment to work on it. (only noticed this question because I’m subscribed to the Zola forum newsletter)

Also heres a bash script you could use for manual deployment, no time to explain it at the moment, but if your familiar with linux you can probably tell what im doing:


rsync -zvrh --delete --exclude 'sass/_variables.scss' ~/.dev/abridge ~/.dev/mysite/themes/
cd ~/.dev/mysite && rsync -zvrh --delete themes/abridge/content/static content/
zola build

#tinysearch --optimize --path static public/data_tinysearch/index.html
#stork build --input public/data_stork/index.html --output static/
npm run abridge && zola build

cd public
find ~/.dev/mysite/public -type f -regextype posix-extended -regex '.*\.(htm|html|css|js|xml|xsl|txt|svg|otf|eot|ttf)' -exec gzip --best -k -f {} \+ -exec brotli --best -f {} \;
rsync -zvrhog --chown=www-data:www-data --delete ~/.dev/mysite/public/ webhost:/var/www/mysite

Oh also, the abridge demo is hosted on netlify, and they support using npm build, so if you want to automate your site from a git repo then you totally can. that is how this site gets built:

take a look at the netlify.toml file:

That looks a lot like a makefile. Damn, i hate - and also like - makefiles.

Abridge is excellent btw. Thanks.

1 Like