Problem/Motivation

Right now, Minify requires use of the Drupal UI to generate minified JavaScript files. This is suboptimal and makes it difficult to deploy the minified configuration consistently across environments such as testing and production.

Proposed resolution

There's various ways in which this could be improved. I'm not really sure which is most relevant yet, but sub-issues can be opened once we think about it more.

Initial brainstorming:

- Drush command
- Minify unminified files on Cron
- Write minified files to sites/all/libraries instead (and offer download button to get a zip of files that can be unpacked there if we don't have write permission to the server) — this way they can just be committed to version control and deployed normally.

Remaining tasks

  • Determine implementation(s)
  • Open sub-issues
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

atul.bhosale’s picture

Hi Kevin Kaland (wizonesolutions),

Thanks for motivation for module features and interest as co-maintainer as you send me separate message using contact.

Below is the reply:
- Drush command : On this addition currently we are working on it. (As I mention in https://www.drupal.org/node/2328153, due some plan activity and some addition commits are pending).

- Minify unminified files on Cron : Minify use the Google closure compiler to minify JavaScript files. When any one contentiously sends the request to API, API returns and Error code 22 (Too many compiles performed recently. Try again later.). Refer "Error Messages" section at https://developers.google.com/closure/compiler/docs/api-ref. Minify files on Cron may fail at some point when number of JavaScript files are more (but keep it open for now and will update on this latter).

Also once JavaScript file is minify, no need to do this again and again unless and until file is updated/changed. (In new release file change flag is already added.)

- Write minified files to sites/all/libraries : Will update on this latter.

atul.bhosale’s picture

Assigned: Unassigned » rahul.shinde
Niremizov’s picture

Here is patch for adding ability to minify JS on cron runs.

1) Go to admin/config/development/performance
2) Enable Minify JS on cron runs

Niremizov’s picture

1) Go to admin/config/development/performance
2) Enable Minify JS on cron runs

---- In addition to prev commit
* Now on cron runs out of sync files are also updated.
* Error messages are also registered (either as warnings)
* Implemented support for elisea cron (hook-cronapi) - to run cron once per hour.

Why once per hour? Because this is timeout of http://closure-compiler.appspot.com/home (See docs, error 22: https://developers.google.com/closure/compiler/docs/api-ref)

tom.burton’s picture

Status: Active » Reviewed & tested by the community

+1 for patch #4. Running smoothly during several months. Really useful for keeping all the minified files up-to-date.

The last submitted patch, 3: minify-js_on_cron_run-2385769-3.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: minify-js_on_cron_run-2385769-4.patch, failed testing.

philsward’s picture

Any ideas on what need to get the patch to pass testing?

getting: Hunk #2 FAILED at 339