You can also use the specialized collector for Heroku, which launches Grunt tasks during deployment and then disables Grunt in Sails for the production environment. This is a bit more work, but it may become necessary, because Heroku has its own timeout that Grunt can work, too long to crack your assets.
We had success with heroku-buildpack-nodejs-grunt . You can follow the installation instructions in your Heroku application, and then copy the task definition into tasks/register/prod.js to enable the heroku:production task, for example:
module.exports = function (grunt) { grunt.registerTask('prod', [ 'compileAssets', 'concat', 'uglify', 'cssmin', 'sails-linker:prodJs', 'sails-linker:prodStyles', 'sails-linker:devTpl', 'sails-linker:prodJsJade', 'sails-linker:prodStylesJade', 'sails-linker:devTplJade' ]); grunt.registerTask('heroku:production', [ 'compileAssets', 'concat', 'uglify', 'cssmin', 'sails-linker:prodJs', 'sails-linker:prodStyles', 'sails-linker:devTpl', 'sails-linker:prodJsJade', 'sails-linker:prodStylesJade', 'sails-linker:devTplJade' ]); };
Then finally in your app.js file replace
sails.lift(rc('sails'));
with:
var config = rc('sails'); if (process.env.NODE_ENV === 'production') { config.hooks = config.hooks || {}; config.hooks.grunt = false; }
source share