mardi 3 mars 2015

How do I execute a post build hook in an ember-cli Brocfile.js?

I have a ember-cli project that builds to the dist/ directory. I've configured the app to handle assets in the dist/ directory and set the history to use a hash instead of pushState. This allows me to sym-link the index.html to the root. The reasoning is that pushing the project to gh-pages on GitHub requires a root index.html and ember apps require routing to be absolute not relative (AFAIK). GitHub however will not follow sym-links and require a copy of the output index.html. This works and now I have 2 build steps (ember build and cp dist/index.html ./index.html).


How do I tell my Brocfile.js to copy the outputted index.html file after it is done building?


A bit of back-history: I am developing an ember-cli addon. I'm hosting it on GitHub. I need to provide a demo site. gh-pages is the correct place to host the demo site. So I create an ember-cli app in the gh-pages branch. I could not set the output folder to ./ because the ember build will rm -rf the output directory destroying the source. So it has to be dist/. I couldn't use a <meta http-equiv="Refresh"... because Ember borked up the paths and crashes on start. So the solution I had was to sym-link/copy the index.html to a higher level and change ember's config to prepend the dist/ directory to assets and set the routing to hash instead of pushState.


I currently have a deply.sh script that does this but I wanted to know if there was a way using Broccoli for this?





Aucun commentaire:

Enregistrer un commentaire