tomatom
tomatom

Reputation: 469

Sailsjs 0.10.x : How to run the production grunt tasks for a staging environment

Sails.js 0.10x: I added an new file "staging.js" to the config/env folder.

Starting the server with >sails lift --staging shows that the staging file was used.

But it still uses the development grunt tasks. e.g. no minification, dev blueprint settings, etc.

I was wondering if there is an easy way to run the the prod grunt tasks with a new environment like staging?

Upvotes: 1

Views: 695

Answers (1)

kk415kk
kk415kk

Reputation: 1247

In the sails node module of your application, you can navigate to the Grunt lib file (app_base/node_modules/sails/lib/hooks/grunt/index.js). If you look at the code there, under the initialize method, there's a condition to check if the environment is the production environment and calls the production Grunt task. Even though you could edit this condition to include your staging environment, this file isn't meant to be altered - updating the module in the future would erase any changes you make.

The best thing to do would be to go to app_base/tasks/register/prod.js and move your staging environment tasks to be run at prod and just use the prod environment. Alternatively, you could copy the production tasks over to your staging environment tasks.

Upvotes: 2

Related Questions