grunt.task.run() is not working
express, gruntjs, javascript, node.js
Solution
`grunt.task.run` just adds a task to the queue, so it works within an existing task, but not within an external script. Here's a simple technique I've borrowed from `grunt/lib/grunt/cli.js`. Beware--it's not part of the official API. Grunt issue 687 notes the need for an official API for this feature.
var grunt = require('grunt');
process.chdir(__dirname);
var config = require('./Gruntfile');
config(grunt);
console.log('Minifying...');
grunt.tasks(['cssmin']);
Problem
Im trying to use grunt inside my express application. I have something like this: ``` var grunt = require('grunt'); require(process.cwd() + '/gruntfile.js')(grunt); grunt.task.run('development'); ``` But the task seems that is not wokring. (no error is outputed to the console) But if I run directly in console "grunt development" it works fine.