Refer to the parent repo's readme First.
bower.json
file in the root directoryThis buildpack uses a task in your Gruntfile
to build the contents of your app
folder into an optimized dist
folder. This is the same thing the command grunt
does in your yo angular
app. All of this takes place on the heroku server, so all you have to do is push your app's source code to heroku with the standard .gitignore
file . There is no need for you to commit the dist
folder or any other pre-built files like a lot of the other online guides suggest. This buildpack installs all the node_modules
, bower_components
and uses grunt
to build your app.
node.js
web server and add a Procfile
commandI use express
, gzippo
and morgan
with the Procfile
command web: node web.js
. But you can use anything. Here is a sample of my web.js
file:
'use strict';
var gzippo = require('gzippo');
var express = require('express');
var logger = require('morgan');
var nodeApp = express();
nodeApp.use(logger('dev'));
nodeApp.use(gzippo.staticGzip('' + __dirname + '/dist'));
nodeApp.listen(process.env.PORT || 5000);
grunt.registerTask('heroku', ['build']);
This is the task that will be run by heroku on the heroku server. I have just included the build
task here (referring to the standard build
task created by the yo angular
) but you could add the newer:jshint
and the test
task too.
You can also set the environment variable NODE_ENV
on your heroku server if you want the buildpack to call a heroku:$NODE_ENV
task. In that case, here is how the task will look like in your Gruntfile
:
grunt.registerTask('heroku', function (target) {
// use the target to do whatever, for example:
grunt.task.run('build:' + target);
});
heroku config:set BUILDPACK_URL=https://github.com/nknj/heroku-buildpack-yo-angular.git
git push heroku master