asset_compress icon indicating copy to clipboard operation
asset_compress copied to clipboard

Resource is duplicated when defining transitive extensions

Open chyt opened this issue 6 years ago • 7 comments

Consider 3 files:

test/a.js:

var a;

test/b.js:

var b;

test/c.js:

var c;

And the following configuration:

[a.js]
files[] = test/a.js

[b.js]
extend = a.js
files[] = test/b.js

[c.js]
extend = b.js
files[] = test/c.js

Then the result when viewing c.js is:

var a;
var a;
var b;
var c;

where a.js is being reproduced twice. I would expect the result to be:

var a;
var b;
var c;

Is there some way to achieve the desired result outside of explicitly defining everything beyond a first-level extension, or is this a bug/transitive extensions not supported?

chyt avatar Jan 29 '19 01:01 chyt

Is there some way to achieve the desired result outside of explicitly defining everything beyond a first-level extension, or is this a bug/transitive extensions not supported?

You might have to fix how dependencies are de-duplicated. Transitive dependencies should work.

What version of AssetCompress are you using?

markstory avatar Jan 29 '19 02:01 markstory

You might have to fix how dependencies are de-duplicated.

Sorry, not sure what this means. Are you able to replicate this issue with just the basic scenario I described above?

I'm using the latest version, 3.5.0.

chyt avatar Jan 29 '19 02:01 chyt

Sorry, not sure what this means. Are you able to replicate this issue with just the basic scenario I described above?

I mean that it may need a patch/fix made. I don't personally use transitive dependencies like this so it fixing this will be low on my list of things to do. If this is important to you, you may need to help provide a fix.

markstory avatar Jan 29 '19 02:01 markstory

Ah I see. Sure, I can look into it. Just wanted to make sure that this was the expected behavior. Thanks.

chyt avatar Jan 29 '19 03:01 chyt

Hi, so I've been looking into this some more and it seems like this functionality has already been implemented in your mini-asset library that this plugin is depending on. See https://github.com/markstory/mini-asset/commit/4304c90babf40454da308ff0b7a8db7625751ede and extended.ini as a test that very closely resembles what I want to accomplish (extended.js extends libs.js, more.js extends extended.js). Furthermore you have a test here that verifies the expected behavior.

I'm probably missing something, but is there a reason why this functionality wouldn't be available through asset_compress, even though the it already exists in the mini-asset library?

chyt avatar Feb 19 '19 02:02 chyt

@chyt It should be available if you have a version of mini-asset that includes those changes.

markstory avatar Feb 19 '19 02:02 markstory

I believe I do. composer show shows version 1.4.3 which is the latest.

chyt avatar Feb 19 '19 03:02 chyt