Coder Social home page Coder Social logo

Comments (10)

shama avatar shama commented on September 28, 2024

You should be able to specify multiple targets and reference them with grunt connect:dev, grunt connect:dist or grunt connect for all targets.

You can also rename tasks with grunt.renameTask or simply register a new task to point to one or more other tasks: grunt.registerTask('server', ['connect']);

from grunt-contrib-connect.

sindresorhus avatar sindresorhus commented on September 28, 2024

Also, the option thing is already built into grunt 0.4.

Just do:

connect: {
  options: {
    keepalive: true
  }
  dev: {
    options: {
      port: 3010,
      base: 'app/public'
    }
  },
  dist: {
    options: {
      port: 3011,
      base: 'dist/public'
    }
  }
},

from grunt-contrib-connect.

sebv avatar sebv commented on September 28, 2024

Yeah but did you test it? It doesn't seem to work.

It is due to the way you retrieve the config:

grunt.config('connect')

It doesn't follow the task definition, if the task isn't called connect, the config is not used.

Edit: Am using grunt 0.4.

from grunt-contrib-connect.

shama avatar shama commented on September 28, 2024

Oh you're right @sebv. It looks like that changed in this commit. I'm not sure why.

from grunt-contrib-connect.

sebv avatar sebv commented on September 28, 2024

Better ask sindre for advice, there should be guidelines from grunt on the best way to get the config.

But I've debugged it, the problem now is that your config return a complex configuration object rather than flat options.

from grunt-contrib-connect.

sindresorhus avatar sindresorhus commented on September 28, 2024

@cowboy Why the change to not support targets?

from grunt-contrib-connect.

cowboy avatar cowboy commented on September 28, 2024

I don't think it ever supported targets. But it totally can, now's the time to do it! Want to make a PR?

from grunt-contrib-connect.

sindresorhus avatar sindresorhus commented on September 28, 2024

@cowboy I'm pretty sure it did before this commit ccd5ab9#L7L21

from grunt-contrib-connect.

cowboy avatar cowboy commented on September 28, 2024

Let me know what you think of my changes!

from grunt-contrib-connect.

sebv avatar sebv commented on September 28, 2024

Thx @Cowboys it works fine. Maybe, just for this task, it'll be worth explaining in the doc how to rename the task to server. If you are migrating or doing things like this, it's nicer to be able to keep the server task name.

from grunt-contrib-connect.

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.