UserFrosting icon indicating copy to clipboard operation
UserFrosting copied to clipboard

Script hooks for client-side assets

Open Silic0nS0ldier opened this issue 3 years ago • 2 comments

The frontend ecosystem has evolved considerably since UF v4 first released. Some projects utilising UF have also reimplemented their own custom frontends, which introduces manual build steps. We can do better.

The vision here is that UF will have some general hooks which sprinkles can utilise to run build steps within a given sprinkles scope.

Hooks would exist for the following;

  • uf-pre-bundle which runs first in the built-in uf-bundle
  • uf-pre-assets-install which runs first in the built-inuf-assets-install, intended as a hook for running npm i in sprinkles
  • uf-clean which runs in parallel with the built-in uf-clean
  • test, which is an already established convention in the NPM ecosystem. This would be run as part of the bakery test command (with flags to opt-out). I plan on utilising this hook to provide test coverage of our JS scripts.

These hooks would be defined in a sprinkles package.json. A few other changes would be introduced to support this, mainly to account for the existing usage of package.json.

Work on this would occur after https://github.com/userfrosting/UserFrosting/issues/1148

Silic0nS0ldier avatar Apr 24 '21 10:04 Silic0nS0ldier

Some projects utilising UF have also reimplemented their own custom frontends, which introduces manual build steps.

Might be worth exploring Vue.js integration and/or documenting it on learn.

lcharette avatar Apr 24 '21 13:04 lcharette

That was something I was thinking about. A starter sprinkle to demonstrate correct usage, along with supporting docs at learn would be the target.

Silic0nS0ldier avatar Apr 24 '21 13:04 Silic0nS0ldier

Not relevant in UF5 anymore

lcharette avatar Nov 25 '23 02:11 lcharette