ef4 / prember

Prerender Ember apps with Fastboot at build time.
MIT License
195 stars 17 forks source link

Proposal: urlsFromPrember #51

Closed RobbieTheWagner closed 4 years ago

RobbieTheWagner commented 4 years ago

This would allow passing not only urlsForPrember, but also for prember to output urlsFromPrember. The code and the API might not be ideal, but I have had a need to get the urls from prember for quite awhile, so it would be great if we could get this or something like it in!

It doesn't work ideally because it does not seem to be possible to run addons after prember. Possibly because prember's build is async?

Ideally, we could add this in the addon:

 "ember-addon": {
    "configPath": "tests/dummy/config",
    "after": [
      "prember"
    ]
  }

It seems to have no effect though, as my treeForPublic still executed before prember did its build.

RobbieTheWagner commented 4 years ago

@villander there do not seem to be any tests around the existing urlsForPrember, so I have no idea how to write tests for urlsFromPrember.

We should also document this new functionality, which I can definitely do.

villander commented 4 years ago

@rwwagner90 sorry for delay. We don't have coverage on postprocessTree. But you can create tests like this on ember-asset-loader or ember-engines:

RobbieTheWagner commented 4 years ago

@villander no worries! I'm just not sure why we need tests, since none previously existed? If you guys could add an existing one for urlsForPrember, I would be happy to try to mimic it and add one for urlsFromPrember.

villander commented 4 years ago

Makes sense @rwwagner90. Tests are always welcome, but we don't have any tests about it previously.

Can you provide a example this working in a public repo, and add a documentation please? with this, I can approve and add tests after merge.

RobbieTheWagner commented 4 years ago

@villander I used this for some client work, so I don't have it in a public repo, but I can work on a public one and docs, for sure.

RobbieTheWagner commented 4 years ago

@villander I'm unlikely to create a public repo using this for awhile. Can we go ahead and merge it in please?

villander commented 4 years ago

@rwwagner90 can you add documentation for it please?

RobbieTheWagner commented 4 years ago

@villander just added some docs. Hopefully they work for you!

villander commented 4 years ago

Thanks @rwwagner90

villander commented 4 years ago

v1.0.4 publish @rwwagner90, sorry for the delay - https://www.npmjs.com/package/prember