Preload Files Module for Nginx

vbresults nginx-forum at nginx.us
Thu Sep 24 13:31:20 UTC 2015


Send your relevant portfolio [past modules made] and a quote to develop and
test this module.  I will be posting it under my github account for easy
access for myself and anyone else that needs it.  I won't compromise on the
functionality I've requested below even 1 centimeter.

This module "ngx_preload_files" preloads one or more files on the filesystem
into a single variable.  This can be used for tasks like concatenating
critical css and javascript files and inlining them with a substitution
module, all within Nginx.

All parameters accept variables in the standard format.  This is implemented
with a minimal memory and zero performance footprint; all the heavy lifting
happens when nginx configuration loads/reloads.

== Directives ==

Syntax:	preload_files $variable $files [file1 file2 file3  ...];
Default:	—
Context:	http, server, location

Loads $files into $variable.  If any $file is a URI, pull in files with wget
or cURL [whatever is available on the system].

---

Syntax:	preload_files_context_local $path;
Default:	— in server context, $document_root in server context, $uri in
location context;
Context:	http, server, location

The relative path/context for local preload_files [within this directive's
and child contexts without overrides].

Set to "off" (without quotes) to resolve all $files as absolute paths.

---

Syntax:	preload_files_context_remote $url;
Default:	—
Context:	http, server, location

The relative $url for remote preload_files [within this directive's and
child contexts without overrides].

---

Syntax:	preload_files_separator $separator;
Default:	"\n";
Context:	http, server, location

Defines the separator between preload_files [within this directive's and
child contexts without overrides].

---

Syntax:	preload_files_substitute $search $replace [$file];
Default:	—
Context:	http, server, location

Search and replace in $files prior to placing contents in $variable [within
this directive's and child contexts].  This directive can be used multiple
times for different search and replace operations.

If optional third parameter $file is passed, search/replace only occurs
within that file; $file must *exactly* match it's preload_files $files
entry.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261818,261818#msg-261818



More information about the nginx mailing list