solidusio/solidus_dev_support

Skip asset inclusion during installation when the assets don't exist

blocknotes opened this issue · 2 comments

An extension without assets will fail specs because the test_app is always created requiring the assets (even if they don't exist).

Running extension installation generator...
      append  vendor/assets/javascripts/spree/frontend/all.js
      append  vendor/assets/javascripts/spree/backend/all.js
      insert  vendor/assets/stylesheets/spree/frontend/all.css
      insert  vendor/assets/stylesheets/spree/backend/all.css
elia commented

We should add some options to the command I thinks, like: --skip-assets or --skip-frontend-assets, those should work for both the updates and the extension generation.

What about adding a conditional when loading the files instead?

When generating a new extension one may not know from the beginning if assets will be needed... when updating an extension one would need to check if assets files exist and choose the right generator option - but there's still a chance that some manual tweaking would be required, as JS files may be there and CSS not 🤔

If assets need to be introduced later, one may not know that the easiest way to have them loaded is to rerun the solidus generator, and so would end up spending time trying to figure out the problem and how to load them.

I think that having the loaders always in place with conditional loading helps with consistency and would avoid much (if not all) active developer intervention.