ykaragol
ykaragol

Reputation: 6221

ember.js addon: how to manipulate files?

We have 5+ ember.js projects. I've extracted all common features as an addon. Other projects depend my addon with package.json (as npm module).

I want to do some post-processing after my addon upgraded on any project (via npm install). I need to do such processing:

Is there any hook to do these? Is there any documentation for hooks?

Upvotes: 0

Views: 146

Answers (2)

ykaragol
ykaragol

Reputation: 6221

What we did:

  • Override /app/styles.css file: We are not using app/styles files. We created a bower addon to keep our styles. In our ember addon's index.js file, there is a hook called included(app). We use app.import calls to place our styles to the apps.
  • Override router.js: We are not overriding router.js. Modification needs occur very rarely. So we announce it on our releases if any modification is needed.
  • Put some files on /translations directory: After upgrading ember-intl#2.8. We will not need to modify /translations directory.

Upvotes: 0

Timm
Timm

Reputation: 1015

The (npm documentation) provides information about the scripts field of package.json. You could use install or postinstall to run an arbitrary script, which processes your desired changes.

Upvotes: 1

Related Questions