Open mkroehnert opened 11 years ago
@vladikoff this should be pretty straight forward. Is there anything preventing this, and is it something you would like to incorporate?
@sourcey feel free to experiment with stuff!
It seems like the only thing preventing this is that grunt.js needs to expose a runTasks
method or similar which can be called programatically... I'll investigate further...
Created new issue and PR via gruntjs/grunt#1108
Hi @auscaster, thank you very much for working on this issue.
I had a look at the pull request you opened but did not fully understand how it would work with using grunt-init
from within JS programs.
Since I I'd like to prevent you from doing unnecessary work and to clarify what I had in mind I created a code snippet of how I would like to use grunt-init
in a custom project:
var gruntInit = require('grunt-init');
gruntInit.init('template-name', { template-path: 'path/to/custom/location', otherParameter: value } )
.on('end', function (installed) {
console.log(installed);
});
The .on('end', ...)
stuff is taken from the bower
example but something similar might be helpful.
@mkroehnert it seems like I misunderstood the exact issue you were talking about, but all was not in vain since I was able to get grunt
to work directly from JS whereas before it wouldn't. Anyway thanks for clarifying the issue, and I'll take another look when time permits.
@auscaster no problem. Upon second look I got what your proposed patch is about. It seems like this is also a nice addition to Grunt itself.
Bower supports usage through a public API. It would be great to have the same capabilities for
grunt-init
. I would like to usegrunt-init
from inside another program which would include enhancing the search path for template directories.