maxov / gulp-grunt Goto Github PK
View Code? Open in Web Editor NEWRun grunt tasks from gulp
License: MIT License
Run grunt tasks from gulp
License: MIT License
is it usable as of 2016 april? or has it become stale due to no activity in 4 months?
Hi, just wondering why you're setting force to true for all tasks. Is this necessary? It seems like it has the potential to be dangerous and I wonder if there was a reason to do that rather than parameterize it.
Why its given gruntCliDir +
to spawn at
spawn( gruntCliDir + gruntCmd, args, {cwd: cwd} );
On providing a base its trying to execute /grunt which gives error , on removing gruntCliDir +
its working fine
I have some issues after installing macOS Mojave.
Can't use gulp-grunt with node 11.1.0:
/usr/local/Cellar/node/11.1.0/bin/node: bad option: --force
/usr/local/Cellar/node/11.1.0/bin/node: bad option: --force=true
Even grunt-cli installing doesn't help ( https://stackoverflow.com/questions/52150323/grunt-force-fails-with-node-bad-option?rq=1 )
When I pass param:
require('gulp-grunt')(gulp, {
force: false
});
I still get:
/usr/local/Cellar/node/11.1.0/bin/node: bad option: --force=false
It's my gulp config:
var gulp = require('gulp');
require('gulp-grunt')(gulp,{
base: './',
prefix: 'grunt-',
verbose: false
});
gulp.task('tpl', function() {
return gulp.start('grunt-tpl');
});
when i execute gulp tpl
,my console throw event error:
$ gulp tpl
[18:36:26] Using gulpfile f:\A_local\vipMobile\gulpfile.js
[18:36:26] Starting 'tpl'...
[18:36:26] Starting 'grunt-tpl'...
[18:36:26] Finished 'tpl' after 4.99 ms
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn .//grunt.cmd ENOENT
at exports._errnoException (util.js:874:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:439:9)
at process._tickCallback (node.js:353:17)
at Function.Module.runMain (module.js:469:11)
at startup (node.js:134:18)
at node.js:961:3
But,grunt tpl
run well.
I have a use case where-by when parsing the grunt file and creating gulp tasks, I need to be able to specify a dependency for the for the gulp task that gets created. For example, given the following gulp task:
gulp.task('create-some-files', function() {
var stream = //create some files in a specific location
return stream;
});
I have a gruntfile somewhere that uses the files that are created in the gulp task:
grunt.initConfig({
useSomeFiles: {
src: '/path/to/files/created/in/gulp/task'
}
});
It would be ideal if when loading gulp-grunt, I could specify a dependency for the grunt task. Maybe something like:
require('gulp-grunt')(gulp, {
deps: {
useSomeFiles: 'create-some-files'
}
});
which would result in a gulp task being created with the signature:
gulp.task('grunt-useSomeFiles',['create-some-files'], fn);
I realize there are lots of questions to answer before a workable solution could be implemented. For example, the grunt tasks can have multiple targets, how would you specify dependencies per target, etc.
If it could be figured out, it would be a nice feature to have.
Haw can i use gulp flags like (--release and etc) in grunt task? Is there any possibilities to pass gulp flag (via gutil.env.flagName) to grunt?
Hi!
Here are some extracts from my gulpfile.coffee
and package.json
:
gulp.task "svg2string", ->
gulp.start "grunt-svg2string"
"grunt-svg2string": "^0.1.6",
"gulp-grunt": "^0.5.2",
When i ran gulp svg2string
, i received this cryptic error:
$ gulp svg2string
[16:57:15] Requiring external module coffee-script/register
[16:57:18] Using gulpfile ~/Code/hb_frontend_angular/gulpfile.coffee
[16:57:18] Starting 'svg2string'...
[16:57:18] Starting 'grunt-svg2string'...
[16:57:18] Finished 'svg2string' after 5.56 ms
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34)
Lack of any indication of the reason left us clueless with the cause of the problem and possible solutions. There wasn't even an error message to google for.
While debugging this issue we decided to try running grunt svg2string
. To be able to do that, i had to install Grunt CLI: npm install -g grunt-cli
. After that, the command gulp svg2string
started working fine without issue!
Thus we discovered by luck that gulp-grunt
depends on a globally installed grunt-cli
.
This should not be so. I expect my Gulp recipes to work after doing
npm install -g gulp
npm install
gulp some-grunt-task
gulp-grunt changes the process cwd. Using gulp-grunt as per the README:
require('gulp-grunt')(gulp, {
base: __dirname + '/foo'
});
leads to process.cwd()
being changed to __dirname/foo
. This causes relative gulp.src
paths to silently fail.
This is a great plugin, so thanks for creating it! I had no trouble getting set up using your current docs, and everything seems to work just fine. However, I noticed this in my console:
gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead.
Is there an alternative way of running these tasks? I found this SO page recommending the use of gulp.watch
instead, along with another answer that incorrectly recommended gulp.start
which is disappearing soon.
I'd mostly like to figure out the "right way" and I'd be happy to PR the docs back in order once I understand the best way to set the plugin up.
It doesn't look to me like there's a way to use a specific Grunt target rather than the full task -- the equivalent of running grunt assemble:dev
rather than just grunt assemble
(which runs all the assemble
targets).
I would like to be able to do this. What do you think?
At first I was having a hard time finding a way via the Grunt API to get what would be needed -- but then I found that the grunt.config.get()
method could be used to get the configuration object, whose keys would be target names. So that's one way, unless you know of something better.
Are you able to remove the console.log
on line 66, or at least change it to something more descriptive.
Currently, it doesn't seem like you're checking the exit code for the grunt child process. This is resulting in gulp succeeding when the a grunt task has actually failed.
Hello!
Looks like gulp-grunt plugin does not load configuration, and it may then be unable to run some kind of tasks.
A simple test case can be found here
gulp-grunt stops while loading claiming cannot find srcModules submodule.
V.
it's required to use the package. see #9
it'd be nice to be able to pass any option we wanted to grunt through the options object.
Hi,
Using require('gulp-grunt')(gulp);
my other gulp task and grunt-task never end.
Trying to use gulp-grunt
with this Gruntfile.js
:
https://github.com/angular-ui/bootstrap/blob/master/Gruntfile.js
Terminates with message:
Warning: An error occurred while processing a template (srcModules is not defined). Use --force to continue. Aborted due to warnings.
Running gulp --force
leads to the same effect.
Hi there,
As a few have pointed out already, in your documentation it says that setting options.base
will be used for specifying a custom Gruntfile.js location. However, in the code it is being used as the path to the grunt executable. This is causing ENOENT errors because it is trying to spawn from an invalid location. (Since the grunt executable would not likely exist in the same directory as the Gruntfile, its either globally installed /usr/bin
(etc) and on the PATH, or when grunt-cli
is a dependency it would be in node_modules/.bin
)
A solution would be to have two separate options for the Gruntfile location and the grunt executable
As a side note, the mocha tests are not picking this error up because it seems that the overriding of process.stdout.write
is having the side effect of squelching the failing tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.