You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My application has been structured with several root dirs such as "layouts", "routes" and "partials". Under each of those directories, each directory is a separate component, thereby keeping each package's assets self-contained. (and everything is wired together via local)
Unfortunately, once I have more than one component with the same name, (under different directories) I start having conflicts because there's only 1 "namespace" for copying assets. (eg. images)
I have tried a few different approaches, but none seem to work and there definitely should be a workaround here. (scripts/styles are handled fine, it's the assets that need to be handled better)
Attempt 1: I added a "suffix" (ie. "-partial", "-layout") in each component.json, hoping it would use that name for determining directory names. Unfortunately, that does not work, as it uses the "basename" no matter what.
Attempt 2: I tried using a more "abstracted" approach to pulling in those locals. For example, I used "locals": [ "partials/explore", ... ] (from the root) rather than using a partials/component.json. Unfortunately, that renames to partials-explore and cannot find the assets when it goes to copy/link them.
Attempt 3: I'm about to try renaming my directories to use the suffix mentioned in attempt 1. For example, partials/explore-partial, but that's tremendously clumsy and I feel like there should be a better way.
I think the assetsDest should be determined a little more intelligently, perhaps calculated based on it's path relative to the root. Perhaps, we can allow the component.json:name to override the usage of basename where it differs.
tl;dr
Using local components with the same directory name (even if from different directory trees like "routes" and "partials") results in conflicts when assets are copied. The process of copying assets should be a little more intelligent, or at least able to detect clashes.
The text was updated successfully, but these errors were encountered:
I've used 0.10.1 (latest component) and even tried a manual usage of 0.11.2. (both have the same behavior)
I haven't yet tried the 0.12 release, but based on my review of the code, it seems to have the same behavior. (but since I haven't tried, I don't know)
My application has been structured with several root dirs such as "layouts", "routes" and "partials". Under each of those directories, each directory is a separate component, thereby keeping each package's assets self-contained. (and everything is wired together via
local
)Unfortunately, once I have more than one component with the same name, (under different directories) I start having conflicts because there's only 1 "namespace" for copying assets. (eg. images)
I have tried a few different approaches, but none seem to work and there definitely should be a workaround here. (scripts/styles are handled fine, it's the assets that need to be handled better)
Attempt 1: I added a "suffix" (ie. "-partial", "-layout") in each
component.json
, hoping it would use that name for determining directory names. Unfortunately, that does not work, as it uses the "basename" no matter what.Attempt 2: I tried using a more "abstracted" approach to pulling in those locals. For example, I used
"locals": [ "partials/explore", ... ]
(from the root) rather than using apartials/component.json
. Unfortunately, that renames topartials-explore
and cannot find the assets when it goes to copy/link them.Attempt 3: I'm about to try renaming my directories to use the suffix mentioned in attempt 1. For example,
partials/explore-partial
, but that's tremendously clumsy and I feel like there should be a better way.I think the
assetsDest
should be determined a little more intelligently, perhaps calculated based on it's path relative to the root. Perhaps, we can allow thecomponent.json:name
to override the usage ofbasename
where it differs.tl;dr
Using
local
components with the same directory name (even if from different directory trees like "routes" and "partials") results in conflicts when assets are copied. The process of copying assets should be a little more intelligent, or at least able to detect clashes.The text was updated successfully, but these errors were encountered: