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

Need file order in configuration. #37

Open
nathanhammond opened this issue Nov 15, 2016 · 6 comments
Open

Need file order in configuration. #37

nathanhammond opened this issue Nov 15, 2016 · 6 comments

Comments

@nathanhammond
Copy link
Contributor

We cannot simply rely on file name lexicographic ordering from broccoli-funnel for generating the asset manifest.

Since ember-asset-loader respects the ordering in terms of insertion order (which matters) we need to provide a way to configure file order.

@trentmwillis
Copy link
Member

Can you provide an example of what you mean and why this matters? The asset-manifest shouldn't care about order, since it is a map and not an array, and is generated from the filesystem, which means that collisions should be impossible.

@nathanhammond
Copy link
Contributor Author

nathanhammond commented Nov 15, 2016

The manifest itself doesn't care about its order, but we use the order from the manifest for DOM insertion order.

This is an example of the point at which it starts to matter, a folder consisting of:

  • csswhichmustgolast.css
  • fancycssframework.css

Those will both be listed inside of the bundle, but we care about the order in which they appear in the document. We currently luck out that engine.css is lexicographically sorted before engine-vendor.css.

This config will need to be passable into the addon this addon provides.

@trentmwillis
Copy link
Member

One could argue (not sure if I would at this moment in time) that within a given bundle, order should not matter. If order does matter, then those files should be concatenated in the proper order. That way, order then only matters between bundles, which I think becomes a much more tractable problem as far as API design is concerned.

@nathanhammond
Copy link
Contributor Author

If you wish to create separate files for caching reasons manual concatenation makes less sense–which is the reason for the split of engine and engine-vendor. I see a bundle as "one atomic unit of code" so subdividing the atom for simple ordering feels bad instinctively. Regardless I think we should whiteboard a few different API proposals (including making it the responsibility of the upstream consumer).

@jasonmit
Copy link

jasonmit commented Oct 11, 2018

I'm also running into this between engine.css and engine-vendor.css because of fingerprinting swaps the order of the assets array.

To work around this, I've reimplemented getManifest() to sort on a new field that is the original uri minus the hash from the broccoli-asset-rev. Not the prettiest of things, and certainly breaks down in many scenarios, but it will give me deterministic output between my dev and prod builds.

Ideally, this would be configurable at the engine level feeding the result to the host app. If I come up with anything, I'll send a PR.

@villander
Copy link
Member

@jasonmit can you send the PR, please? I would love to see this

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

No branches or pull requests

4 participants