Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local component name clashes for assets (workaround?) #162

Open
dominicbarnes opened this issue Feb 13, 2014 · 2 comments
Open

Local component name clashes for assets (workaround?) #162

dominicbarnes opened this issue Feb 13, 2014 · 2 comments

Comments

@dominicbarnes
Copy link

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.

@yields
Copy link
Contributor

yields commented Feb 13, 2014

what builder version are you using ?

@dominicbarnes
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants