Build for PHP framework


#1

I have an Ember app that’s part of a component for a php framework. Currently, whenever I build a new version, I have to copy all the js and css files over and manually update the checksums in a php file. I’m trying to automate these tasks.

I think I’ve solved my first problem which is building to a php file instead of a html file by changing the index.html to default.php in ember-cli-build.js, but my problem now is that a lot of extra information is included in there that I don’t need. For instance, all the head and body declarations. I just need the script and link tags for the vendor and app assets and some php specific stuff.

If I add the php stuff to the index.html file, it causes issues and I need the head and body tags while I’m developing. Is there anyway to use a different index.html (or a index.php) file when I’m doing a production build? Can anyone give me some ideas on how to approach this? Thanks.


#2

Can you provide some details about the structure of your project? Might be helpful

If you want to run the Ember App inside of your PHP project/frame, I dont think you need to change the index.html. You can basically paste the stuff of your index.html to your .php file.

For building/copying I’d recommend a task runner like gruntjs. That should solve the missing vendor css/js files


#3

Perhaps you can use: https://github.com/dschmidt/ember-cli-deploy-cp


#4

The copying part isn’t too hard to fix. I’ll just create an in-app addon and hook onto outputReady.

The hard part is figuring out how to have a different index file for just production. The syntax is very different. Like I said about, I don’t need head or body tags; those are taken care of by the framework and template. To do stuff like set the title, I have to do:

<?= @title('App Title') ?>

Could anyone help point me in the direction of doing this with broccoli? I’ve tried figuring it out Ember’s build pipeline, but it’s very confusing. I was hoping there’d be an easy way to just build the app separately.