m2-devtools icon indicating copy to clipboard operation
m2-devtools copied to clipboard

Idea: Execute optimization automatically after static-content:deploy

Open davidverholen opened this issue 7 years ago • 1 comments

This issue is a:

  • [ ] Bug
  • [x] Feature suggestion
  • [ ] Documentation issue
  • [ ] Other (Please Specify)

Description

  • once the build config is present somewhere in the project, probably all steps after that could be automated by hooking into the static-content deploy process of magento
  • Maybe add a flag to setup:static-content:deploy command to trigger optimization

Preconditions

  • requirejs has to be installed and available as command
  • magento js minification disabled (could probably be automated)
  • static content deploy mode can possibly not be compact

Steps after a Theme is deployed

  • copy theme to <theme_dir>_source
  • execute rjs optimizer
  • remove _source dir?

davidverholen avatar Dec 11 '18 09:12 davidverholen

For now I use static:content-deploy

  • gulp babel / styles --prod (from frontools directory)
  • set of gulp tasks (from tools-rjs-optimizer directory*)

*(based on frontools) - I've created similar tool with similar structure (but in separate project - not public yet) for -- preparing assets/backup of generated static assets (for testing on local in production mode to skip static:content-deploy if we want to test different build configuration)

  • running r.js optimizer
  • have compress task to compress require.js (as it is in /pub/static/_requirejs/frontend/vendor/theme/locale_Locale/requirejs-config.js)

Probably it would good if something similar could be added to static-content:deploy command via some extra flags for people who need it.

Depending on our implementation we will think about sharing it or even adding to the frontools.

Januszpl avatar Dec 13 '18 18:12 Januszpl