Omitting Images from build


#1

Hi, I have an application in ember.js and developing with the ember-cli . One of the difficulties I have encountered is trying to accommodate changes for individual customers, under a configuration file.

I have the odd {{#if this}}putthistemplatein{{else}}put thattemplatein{{/if}}. This seems to work well and speeds up development because I’m not having to keep track of previous builds and so on, I get to know the application well and look at it every day and that in itself is a catalyst.

However, every customer tends to have different images associated (catalogue and label images) and I find when I do a build (ember build -environment=production) for a particular customer (I give customers their own copy of the final production build) they are getting ALL the images from all the other customers.

Is there a way in ember-cli-build.js to NOT INCLUDE certain image paths. I know you can turn off finger printing etc for paths, but can you omit whole packages from being built?


#2

I do something similar for environment specific robot.txt files. See:

I delete the not used ones afterwards but this is perhaps the wrong way around in your case. That said it should be possible to write a module for this. broccoli-stew is your friend.


#3

Thanks, would I just write this stuff in ember-cli-build.js directly? I haven’t steered very far away from the default setup up to now. I don’t know much about node.js


#4

No in any addon you can add hooks like treeForPublic in the index.js file.


#5

When you say “addon”,do you mean a broccoli addon or a ember-cli add-on? Sorry, the big picture is lost on me with the build


#6

The index.js from an add-on is used by ember-cli to build.

Just use one hook like treeForPublic and console.log something to see when it is called. See hooks

https://ember-cli.com/api/classes/Addon.html