Skip to content

Commit 92339c1

Browse files
committed
COLDBOX-820 #resolve
copy current issue url Elixir methods now take in a manifestRoot argument so you can override the root location
1 parent 8b9d39a commit 92339c1

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

system/modules/HTMLHelper/models/HTMLHelper.cfc

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,20 +2301,23 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
23012301
* @async HTML5 JavaScript argument: Specifies that the script is executed asynchronously (only for external scripts)
23022302
* @defer HTML5 JavaScript argument: Specifies that the script is executed when the page has finished parsing (only for external scripts)
23032303
* @version The elixir version to use, defaults to 3
2304+
* @manifestRoot The root location in relative from the webroot where the `rev-manifest.json` file exists
23042305
*/
23052306
function elixir(
23062307
required fileName,
23072308
buildDirectory="build",
23082309
boolean sendToHeader=true,
23092310
boolean async=false,
23102311
boolean defer=false,
2311-
numeric version=3
2312+
numeric version=3,
2313+
manifestRoot=""
23122314
){
23132315
return addAsset(
23142316
elixirPath(
2315-
fileName = arguments.fileName,
2316-
buildDirectory = arguments.buildDirectory,
2317-
version = arguments.version
2317+
fileName = arguments.fileName,
2318+
buildDirectory = arguments.buildDirectory,
2319+
version = arguments.version,
2320+
manifestRoot = arguments.manifestRoot
23182321
),
23192322
arguments.sendToHeader,
23202323
arguments.async,
@@ -2328,12 +2331,15 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
23282331
* @fileName The asset path to find relative to the `includes` convention directory
23292332
* @buildDirectory The build directory inside the `includes` convention directory
23302333
* @useModuleRoot If true, use the module root as the root of the file path
2334+
* @version The elixir version algorithm to use, version 3 is the latest
2335+
* @manifestRoot The root location in relative from the webroot where the `rev-manifest.json` file exists
23312336
*/
23322337
function elixirPath(
23332338
required fileName,
23342339
buildDirectory="build",
23352340
boolean useModuleRoot=false,
2336-
numeric version=3
2341+
numeric version=3,
2342+
manifestRoot=""
23372343
){
23382344
// Cleanup
23392345
arguments.fileName = reReplace( arguments.fileName, "^/", "" );
@@ -2362,6 +2368,11 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
23622368
"#appPath##includesLocation#/rev-manifest.json" :
23632369
"#appPath##includesLocation#/#arguments.buildDirectory#/rev-manifest.json";
23642370

2371+
// Do we have a manifest override?
2372+
if( len( arguments.manifestRoot ) ){
2373+
manifestPath = controller.locateFilePath( "#arguments.manifestRoot#/rev-manifest.json" );
2374+
}
2375+
23652376
// Calculat href for asset delivery via Browser
23662377
if( mapping.len() ){
23672378
var href = "/#mapping#/#includesLocation#/#arguments.fileName#";
@@ -2857,4 +2868,4 @@ component extends="coldbox.system.FrameworkSupertype" accessors=true singleton{
28572868
return this;
28582869
}
28592870

2860-
}
2871+
}

0 commit comments

Comments
 (0)