jieiku
July 31, 2022, 3:55am
1
Here is my current netlify.toml for the abridge theme:
[build]
publish = "public"
command = "zola build"
[build.environment]
ZOLA_VERSION = "0.16.0"
[context.deploy-preview]
command = "zola build --base-url $DEPLOY_PRIME_URL"
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
Strict-Transport-Security = "max-age=63072000; includeSubdomains"
Content-Security-Policy = "default-src 'none'; frame-ancestors 'none'; object-src 'none'; base-uri 'self'; manifest-src 'self'; connect-src 'self'; form-action 'self'; script-src 'self'; img-src 'self' data: cdn.cloudflare.com; frame-src 'self' www.youtube-nocookie.com player.vimeo.com; media-src 'self' data: cdn.cloudflare.com www.youtube-nocookie.com player.vimeo.com; font-src 'self' cdn.cloudflare.com cdn.jsdelivr.net fonts.gstatic.com; style-src 'self' 'unsafe-inline' cdn.cloudflare.com cdn.jsdelivr.net fonts.googleapis.com;"
What I am needing now instead is the equivalent of:
zola build
uglifyjs public/search_index.en.js public/elasticlunr.min.js public/search.js -o static/search_bundle.min.js -c -m
zola build
the first zola build is simply to generate a current search_index.en.js, then I issue uglifyjs to bundle these 3 files into a single search bundle, then issue another zola build to deploy with the search bundle
ALSO! if anyone knows how to accomplish this without running zola build twice then please let me know. (maybe a way to generate the elasticlunr index without using zola build?)
jieiku
August 7, 2022, 5:17am
2
I actually figured this out, you can see it here:
{
"name": "abridge-bundle",
"version": "1.1.0",
"description": "Abridge - bundle and minify js",
"author": "Jake G <106644+Jieiku@users.noreply.github.com>",
"license": "MIT",
"homepage": "https://github.com/Jieiku/abridge",
"scripts": {
"searchonly": "uglifyjs static/elasticlunr.min.js static/search.js -c -m -o static/abridge-searchonly.min.js",
"noswitcher": "uglifyjs static/prestyle.js static/email.js static/codecopy.js static/elasticlunr.min.js static/search.js -c -m -o static/abridge-noswitcher.min.js",
"nofacade": "uglifyjs static/prestyle.js static/theme_button.js static/email.js static/codecopy.js static/elasticlunr.min.js static/search.js -c -m -o static/abridge-nofacade.min.js",
"theme": "uglifyjs static/theme.js -c -m -o static/theme.min.js",
"katex-bundle": "uglifyjs static/katex.min.js static/mathtex-script-type.min.js static/auto-render.min.js static/katexoptions.js -c -m -o static/katexbundle.min.js",
"search-bundle": "uglifyjs public/search_index.en.js public/elasticlunr.min.js public/search.js -c -m -o static/search_bundle.min.js",
"search-bundle-stork": "uglifyjs static/stork.js -c -m -o static/search_bundle.min.js",
"search-bundle-tinysearch": "uglifyjs static/tinysearch.js -c -m -o static/search_bundle.min.js",
"sha256": "sha256=$(shasum -b -a 256 'static/search_bundle.min.js' | awk '{ print $1 }') && echo $sha256 && sed -i \"s|sha256='.*'|sha256='$sha256'|\" 'themes/abridge/static/search_facade.js' 'themes/abridge/static/search_facade_module.js'",
"sha256-demo": "sha256=$(shasum -b -a 256 'static/search_bundle.min.js' | awk '{ print $1 }') && echo $sha256 && sed -i \"s|sha256='.*'|sha256='$sha256'|\" 'static/search_facade.js' 'static/search_facade_module.js'",
"sha384": "sha384=$(openssl dgst -sha384 -binary 'static/search_bundle.min.js' | openssl base64) && echo $sha384 && sed -i \"s|sha384='.*'|sha384='$sha384'|\" 'themes/abridge/static/search_facade.js' 'themes/abridge/static/search_facade_module.js'",
"sha384-demo": "sha384=$(openssl dgst -sha384 -binary 'static/search_bundle.min.js' | openssl base64) && echo $sha384 && sed -i \"s|sha384='.*'|sha384='$sha384'|\" 'static/search_facade.js' 'static/search_facade_module.js'",
This file has been truncated. show original