danbrellis
danbrellis

Reputation: 399

Trigger Gulp Task (watch) from Gruntfile

I'm working on my first angularjs project and went with this framework generator (https://www.npmjs.com/package/generator-leptir-angular-bootstrap) to use bootstrap with scss/less.

The leptir uses gulp to compile (this works fine) but the bower_component bootstrap uses grunt to compile. My issue is that when I want to modify bootstrap less files, I need to compile the bootstrap.min.css with grunt, then rerun gulp watch in the parent directory to compile that min.css with the bower and custom scss, plus trigger the browser refresh, etc.

What I want to know is, is there a way I can directly run or artificially trigger a gulp task (in this case gulp watch) inside a gulpfile from a separate gruntfile?

I tried using grunt.touch after my scss is compiled, but that doesn't seem to trigger gulp watch. Any other thoughts?

my-project
  |- public
     |- bower_components
        |- bootstrap
           |- less (directory of all my bootstrap less files)
           |- Gruntfile.js
           |- package.json
  |- app.scss (when changed, triggers gulp.watch)
  |- gulpfile.js
  |- package.json

Upvotes: 0

Views: 57

Answers (1)

Marko Manojlovic
Marko Manojlovic

Reputation: 356

So you are using Gulp and Grunt along with Less and Scss in one project? That sounds complicated without the need to be complicated. Any specific reason you are going for that setup or generator got you in that position?

I would suggest moving everything to gulp config and going with either less or either scss and avoid mixing those 2. While that technically can work i don't see a reason to do that, and it can raise complexity of your source code.

Let me know more details in the reply.

Upvotes: 0

Related Questions