Skip to content

docs(server): serve precompressed theme assets, enable HTTP/2, minify JavaScript when needed - #90

Open
pierrebaguet wants to merge 2 commits into
thelia:mainfrom
pierrebaguet:feat/296-precompressed-assets
Open

pierrebaguet wants to merge 2 commits into
thelia:mainfrom
pierrebaguet:feat/296-precompressed-assets

Conversation

@pierrebaguet

@pierrebaguet pierrebaguet commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

The Flexy and default-twig themes now write precompressed copies of their assets when they are compiled for production. The server pages did not say how to serve them, and nothing in the documentation mentioned HTTP/2, which matters for a theme that loads one JavaScript file per module.

What

In docs/ (Next): the published 3.2 version stays as it is until the theme and core releases ship this.

  • getting-started/nginx-configuration.md: a location ^~ /assets/ block with gzip_static, brotli_static (ngx_brotli) and try_files $uri =404, which is needed because both directives serve a compressed file without checking that its original exists. It extends the block of the CDN page instead of adding a second one. New sections on HTTP/2, on the precompressed formats and how to restrict them, and on minifying JavaScript with sensiolabs/minify-bundle, with the gain measured on the demo (about 7 KB on the home page, 10 KB on a product page, after Brotli).
  • getting-started/apache-configuration.md: the rules public/.htaccess carries from 3.3, for an older file or a virtual host without .htaccess, and why they are ignored in a <Directory> block while the .htaccess is read. HTTP/2 with mod_http2.
  • getting-started/cdn.md: points to the nginx block, and the compile pitfall now mentions the minified stylesheet and the copies.
  • upgrading/update.md: compile the assets in production after an update.

Core pull request: thelia/thelia#4228. Theme pull requests: thelia-templates/flexy#312, thelia-templates/default-twig#154.

Tests

npm run build passes, with no broken link in these pages. The Apache rules were run on Apache 2.4.69: placed in the .htaccess they serve the copies with the right headers; placed in <Directory> while the .htaccess is read, they are ignored. The nginx block was checked on nginx 1.26 with the brotli module, with a fallback to index.php instead of =404 so that the development server keeps working.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant