mercredi 30 août 2017

Ember 2, ember-cli, custom addon, hook to modify text in js before final integrity (ember-cli-sri)

After this question Ember,js. Modify app.js and vendor.js before the final integrity seal. One custom step in build pipeline? I'm building an addon for modify the js before the final integrity step (with ember-cli-sri).

lib/modify-js-before-build/index.js

/* eslint-env node */
'use strict';

module.exports = {
  name: 'modify-js-before-build',

  isDevelopingAddon() {
    return true;
  },

  postprocessTree(type, tree) {

    // WHAT TO DO!?

  }

};

lib/modify-js-before-build/package.json

{ ...,
"ember-addon": {
    "before": "ember-cli-sri"
  }
}

But I'm stucked here, I don't know how to do (I do not know very well broccoli). How can I tell it to add some text in my app.js and vendor.js before ember-cli-sri and other build steps?

I found this one: http://ift.tt/2ekOrB4. They are using broccoli-concat and broccoli-merge-trees. Something similar to me? But how?




Aucun commentaire:

Enregistrer un commentaire