<CFIMPORT prefix="ld" taglib="/#myMapping#/widg...
# lucee
m
<CFIMPORT prefix="ld" taglib="/#myMapping#/widgets"> Is there any way possible to make cfimport work with a variable like this? I try but it fails.
I have hundreds of files using cfimport, and I would like to be able to use the same code on dev and production (same server), but I can't... I have to either modify production code, or I have to use a CFIF to control the path (neither of which are good solutions)
z
it's a compile time directive so it can't be dynamic
I know it's annoying eh?
m
yes, VERY.... it's making it difficult to have multiple sites on the same server. after I deploy files, I need to search/replace for the cfimports to correct the location.
a
An import should be relative to a location in the codebase, it should not be relative to a "site". You might be misusing the intent of imports if you need them to be site (tenant?) specific? If you have a lib at say
/com/you/yourlib
and each tenant has their own version of that (because like tenant x is using 1.0 still, and tenant y is using 2.2 etc), then your imports should keep saying
/com/you/yourlib
, but your mapping to same should point to the tenant's version of the code. Your codebase should not know about the concept of "tenants". (guessing at your requirement here, so might have the wrong end of the stick, but you "oughtn't" need a variable in there, I think.
☝️ 1
m
thanks for the extra details