Code Monkey home page Code Monkey logo

Comments (6)

kozmic avatar kozmic commented on May 18, 2024

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.

from retire.js.

eoftedal avatar eoftedal commented on May 18, 2024

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

from retire.js.

jellekralt avatar jellekralt commented on May 18, 2024

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 :)

from retire.js.

kozmic avatar kozmic commented on May 18, 2024

@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 :)

from retire.js.

peterkr avatar peterkr commented on May 18, 2024

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?

from retire.js.

kozmic avatar kozmic commented on May 18, 2024

@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": "*"
  }
}

from retire.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.