Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp plugin for retire? #82

Closed
phun-ky opened this issue Apr 13, 2015 · 6 comments
Closed

gulp plugin for retire? #82

phun-ky opened this issue Apr 13, 2015 · 6 comments

Comments

@phun-ky
Copy link

phun-ky commented Apr 13, 2015

Anyone got a gulp-plugin for retire? If not, when can we see it? Could make one myself, but don't got much time at the moment :/

@kozmic
Copy link
Member

kozmic commented Apr 13, 2015

Have you tried using retire.js directly in your gulpfile? Usually you don`t need a plugin in gulp for tasks ( see gulp plugin guidelines), you just use the node modules directly. I haven't tried this myself.. we should probably have an example configuration in the readme.

@eoftedal
Copy link
Contributor

Sounds like something we definitely should do!
Any of you up for the challenge?

@jellekralt
Copy link
Contributor

Just wanted to share my two cents:

@kozmic, you're definitely right, if you can use a node module directly, you could probably whip up a custom task pretty easily. Thats a problem for retire.js though, because (correct me if i'm wrong) as far as I can tell, there is no exported function from the retire package that you can use for this. The only way of doing this would be taking a lot of code from the cli wrapper and putting it into a custom gulp task. So for that matter, a gulp plugin might be a considerable option.

That being said, there is always the option of keeping it very simple and just use the cli to run when a .js file, the bower.json or package.json file changes. Which could look something like this:

gulp.task('retire', function (done) {

    gulp.watch('package.json', function() {
        child_process.spawn('retire', ['--node'], {
            stdio: 'inherit'
        }).once('close', done);
    });

});

With a few simple adjustments you could send the streamed response data from the process to the gulp log.

Personally, I'm not thrilled by spawning child processes to run bash stuff, but then again, as log as there is no real way to talk to retire through a require, this might be the best option. Also, even if you were able to talk directly to retire, you still couldn't use gulp's piping system to its full potential because retire will read the file content again instead of taking it from the gulp pipe.

I'd be happy to whip up an example gulp task for this repo, let me know if you agree with my conclusions (or if you don't :)

@kozmic
Copy link
Member

kozmic commented Jul 24, 2015

@jellekralt I agree with all your comments. Until we have time to refactor the API from retire.js, so it can be used easly with gulp, I would really appreciate an update to Readme.md with an gulp example :)

@peterkr
Copy link

peterkr commented Jun 16, 2017

One small question regarding to the usage of retirejs. Should we need to install npm package globally to run this with gulp or can we run through devDependencies?

@kozmic
Copy link
Member

kozmic commented Jun 19, 2017

@peterkr You don't need it globally installed, it can be included in devDependencies. But note that then the retire executable will be in node_modules/.bin/retire.

As an example, npm run retire will execute retire from a locally installed retire through devDependencies with this package.json:

{
  "name": "retirejs-example",
  "scripts": {
    "retire": "node_modules/.bin/retire"
  },
  "devDependencies": {
    "retire": "*"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants