Reputation: 4440
This is probably going to sound stupid as can be, but please bear with me. I am having trouble with it.
I am working on a project that uses Grunt
to compile and construct its distribution. However, it uses another library known as prism
, which you can find at http://prismjs.com
Now, prism
is a wonderful library, and I do like it. However I am installing it to my application using bower
- it's simple enough, bower install prism --save-dev
Now the problem I run into is that prism downloads as its own source code - which happens to not have the compiled source I need, but rather a gulpfile.js
that creates the compiled source. I'm typically pretty happy with that, I do love me some gulping goodness - but in this situation I'm at a bit of a loss because I've never encountered a situation where I was using grunt
to also use gulp
.
The folder structure ends up like this;
/-root
| - bower_components
| - - bootstrap
| - - jquery
| - - jquery-colorbox
| - - prism
| - - - components
| - - - plugins
| - - - themes
| - - - vendor
| - - - .bower.json
| - - - bower.json
| - - - components.js
| - - - gulpfile.js
| - - - package.json
| .gitignore
| bower.json
| Gruntfile.js
| package.json
| README.md
So what I need to do is figure out how to run /bower_components/prism/gulp.js
from /gruntfile.js
, such that it produces the compiled result, which my gruntfile.js
can then use to dispatch out to my /dist
folder.
I do know that I can just clone the prism
repository separately and do it, but I wanted the experience of building my library to be self contained, all in one sort of thing. Is this possible? Or am I just dumb?
Upvotes: 1
Views: 539
Reputation: 35806
I'll develop a little what @Benjamin said.
You can indeed run commands directly from your Gruntfile
by using the grunt-exec plugin or the grunt-shell one.
A task for your needs could be something like this, using grunt-shell
shell: {
launchPrism: {
command: 'gulp',
execOptions: {
cwd: 'bower_components/prism'
}
}
}
You still need to run a npm install
in the prism directory, but you could also add this to the executed command or in your project install
Upvotes: 3