diff options
author | Sarah German <sgerman@gitlab.com> | 2022-08-18 18:02:30 +0300 |
---|---|---|
committer | Marcel Amirault <mamirault@gitlab.com> | 2022-08-18 18:02:30 +0300 |
commit | ab74a97edcc8a2c366cc68ffa2c5434fb32df423 (patch) | |
tree | 8684d88d9b5d1a4b335d7bb2638242313463f60e /.gitlab | |
parent | 5a2916f6bcdf04f06376213c2e6435f5b44aaae1 (diff) |
Add Lunr.js index script
Diffstat (limited to '.gitlab')
-rw-r--r-- | .gitlab/ci/build-and-deploy.gitlab-ci.yml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/.gitlab/ci/build-and-deploy.gitlab-ci.yml b/.gitlab/ci/build-and-deploy.gitlab-ci.yml index e1ba016e..8cc8aa13 100644 --- a/.gitlab/ci/build-and-deploy.gitlab-ci.yml +++ b/.gitlab/ci/build-and-deploy.gitlab-ci.yml @@ -12,6 +12,8 @@ - bundle exec nanoc compile -VV # Create _redirects for Pages redirects - bundle exec rake redirects + # Build the Lunr.js search index if needed + - if [[ "$ALGOLIA_SEARCH" == "false" ]]; then node scripts/lunr/preindex.js; fi # Calculate sizes before and after minifying/gzipping the static files (HTML, CSS, JS) - SIZE_BEFORE=$(du -sh public/ | awk '{print $1}') # Minify the assets of the resulting site @@ -21,7 +23,7 @@ - SIZE_AFTER_MINIFY=$(du -sh public/ | awk '{print $1}') # Use gzip to compress static content for faster web serving # https://docs.gitlab.com/ee/user/project/pages/introduction.html#serving-compressed-assets - - find public/ -type f \( -iname "*.html" -o -iname "*.js" -o -iname "*.css" -o -iname "*.svg" \) -exec gzip --keep --best --force --verbose {} \; + - find public/ -type f \( -iname "*.html" -o -iname "*.js" -o -iname "*.css" -o -iname "*.svg" -o -iname "*.json" \) -exec gzip --keep --best --force --verbose {} \; - SIZE_AFTER_GZIP=$(du -sh public/ | awk '{print $1}') # Print size results - echo "Minify and compress the static assets (HTML, CSS, JS)" @@ -40,6 +42,7 @@ compile_prod: - .rules_prod - .build_base variables: + ALGOLIA_SEARCH: 'true' NANOC_ENV: 'production' # @@ -49,6 +52,8 @@ compile_dev: extends: - .rules_dev - .build_base + variables: + ALGOLIA_SEARCH: 'false' ############################################### |