Problem/Motivation
CSS/JS optimized assets directory is hardcoded to public://{css,js}
.
A user may want to store optimized assets in a different path for better performance or reliability, for example when public://
is in a slower/unreliable filesystem (for example a network share) and optimized assets can be placed in a faster one.
At present this can only be achieved by adding a symlinks from public://css
to /faster/css
. It is not a desirable solution for several reasons:
* The symlink lives in the slower filesystem and depends on its availability
* Bad performance
* Fragile/tangled setup
Proposed resolution
* Make optimized assets path configurable via a settings variable file_assets_path
. This is the path to the parent directory under which css/
and js/
subfolders live. The default value for this setting is public://
, so by default it works the same as now.
* Create assets://
stream wrapper that abstracts the implementation details of supporting a custom path or the default of public://
Remaining tasks
* Discuss the proposed solution and implementation (settings vs config?, stream wrapper?)
* Create a patch for the agreed solution/implementation
* Add tests
* Review
* ...
User interface changes
There's a new read-only entry in admin/config/media/file-system similar to the one for public/private file system paths, indicating the configured path for the assets folder.
API changes
Developers of contrib modules must start using the new stream wrapper:
before
$css_base_path = "public://css";
$js_base_path = "public://js";
after
$css_base_path = "assets://css";
$js_base_path = "assets://js";
Data model changes
No.
Release notes snippet
...