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

Ability to create new gulpfile.js with `gulp init` command #58

Closed
mikach opened this issue Dec 19, 2013 · 21 comments

Comments

Projects
None yet
@mikach
Copy link

commented Dec 19, 2013

The same functionality as grunt-cli provides.

What do you think?

@contra

This comment has been minimized.

Copy link
Member

commented Dec 19, 2013

Would conflict with a task named init

@mikach

This comment has been minimized.

Copy link
Author

commented Dec 19, 2013

I think npm and grunt have the same problem. But it's ok.

@contra

This comment has been minimized.

Copy link
Member

commented Dec 19, 2013

@mikach Is there a lot of value in this? A sample gulpfile is really basic

var gulp = require('gulp');

// define tasks here
gulp.task('default', function(){
  // run tasks here
  // set up watch handlers here
});

I'm interested in what others think

@mikach

This comment has been minimized.

Copy link
Author

commented Dec 19, 2013

Yes, I agree with you. But it's standard feature for many utils (like npm, grunt, component etc) to just write init and have some stuff from scratch.
It's just my thought.

@sindresorhus

This comment has been minimized.

Copy link
Contributor

commented Dec 20, 2013

I don't see the value at all, but I've seen a lot of people, especially beginners that appreciates that feature in bower and grunt.

@contra

This comment has been minimized.

Copy link
Member

commented Dec 20, 2013

I think a wiki page here https://github.com/wearefractal/gulp/wiki and a link in the README will solve this. Feel free to PR or I'll do it when I have a minute

@contra

This comment has been minimized.

@ivan-kleshnin

This comment has been minimized.

Copy link

commented Dec 19, 2014

I'd like to have an option to configure gulp plugins globally with such "init" task. Now you should either bloat your API or create fragile custom sequences of commands for each case outside of "one-command" ideology.

@webcaetano

This comment has been minimized.

Copy link

commented Apr 30, 2015

+1

@markspolakovs

This comment has been minimized.

Copy link

commented Sep 4, 2015

Would conflict with a task named init

Wouldn't you just be able to detect if there is a Gulpfile.js in the directory, and if not, then create one, if there is, then run the init task?

@devonzara

This comment has been minimized.

Copy link

commented Nov 21, 2015

+1 If the file doesn't exist, create it with a basic template. If it does exist, look for and run the task named init.

@dvdcxn

This comment has been minimized.

Copy link

commented Dec 17, 2015

+1

I found this page because I was googling to find if gulp just used a different command for its init functionality.

Imo it's a simple bit of functionality but keeps it consistent with the rest of the node-sphere.

Sre, a basic gulpfile can easily be copy pasted, but it takes a couple of steps which can break the flow when setting up a build environment if doing so manually.

The fact that people have found this page due to expecting "gulp init" to just work is a pretty good argument for including it.

@phated

This comment has been minimized.

Copy link
Member

commented Dec 17, 2015

This really isn't about a flag, it's that we would be implementing touch gulpfile.js because there's no point in putting anything in the file. Everyone has their own way to structure gulpfiles and that's a great thing.

@webcaetano

This comment has been minimized.

Copy link

commented Dec 18, 2015

@phated Agree.
But a good part of gulp projects come from an yeoman boilerplate. http://yeoman.io/generators/
This is already an good approach for "init".

I think this issue are opening for the wrong repository. This should be in gulp-cli instead.

Or even an new node-module gulp-init that generate multi gulp boilerplates.
But i think this may already exist. Not sure.

People think in gulp init based on other programs that have one like

  • git init
  • npm init
  • bower init

@dvdcxn also found it by google.

@devonzara

This comment has been minimized.

Copy link

commented Dec 18, 2015

Even if it is just a blank file, it would help establish a naming convention. It seems to be agreed upon that package.json and bower.json are all lowercase but with Gulp I often see a variation between Gulpfile.js and gulpfile.js.

Furthermore, even if there isn't really any boilerplate that applies to all projects, you can include some Getting Started information in the file for those who are new to Gulp and links to the docs/recipies.

But yes, gulp init would just be a way of complying with expectations or a seemingly unofficial convention brought forth by other commonly used tools. Regardless of how useful it is for more experienced users, it's more a matter of being intuitive for those who are familiar but may not work with Gulp everyday.

@phated

This comment has been minimized.

Copy link
Member

commented Dec 18, 2015

@devonzara but gulp isn't convention based, that's the whole point behind it. We allow people to name it gulpfile.js to match their package.json or Gulpfile.js to mimic Makefiles if the desire. I've even seen people name a directory gulpfile with an index.js inside which will also work because of node's require system. This flexibility is something we want to promote and not have a mandatory or suggested way to name your files.

@devonzara

This comment has been minimized.

Copy link

commented Dec 18, 2015

Fair enough on the naming.

However, there is a big difference between helping newcomers get up and running quickly with a single gulpfile versus making it mandatory. I wasn't aware of these other variations in use, but perhaps that's to be attributed to the fact that you're 'Getting Started' page is already suggesting (or providing as an example) the 'gulpfile.js' way of handling things and doesn't detail any other methods.

I don't see how including a gulp init would be any different than what is already mentioned on the 'Getting Started' page. It doesn't take away from the flexibility of Gulp and it's not forcing anyone to use gulp init or the single-file route, it just provides a convenience method that is handy to those who are not everyday Gulpers or those who aren't comfortable with OS native commands like touch gulpfile.js or REM. >gulpfile.js.

@markspolakovs

This comment has been minimized.

Copy link

commented Dec 22, 2015

This. So much this.

On Fri, 18 Dec 2015 23:05 Devon Zara notifications@github.com wrote:

Fair enough on the naming.

However, there is a big difference between helping newcomers get up and
running quickly with a single gulpfile versus making it mandatory. I wasn't
aware of these other variations in use, but perhaps that's to be attributed
to the fact that you're 'Getting Started' page is already suggesting (or
providing as an example) the 'gulpfile.js' way of handling things and
doesn't detail any other methods.

I don't see how including a gulp init would be any different than what is
already mentioned on the 'Getting Started' page. It doesn't take away from
the flexibility of Gulp and it's not forcing anyone to use gulp init or
the single-file route, it just provides a convenience method that is handy
to those who are not everyday Gulpers or those who aren't comfortable with
OS native commands like touch gulpfile.js or REM. >gulpfile.js.


Reply to this email directly or view it on GitHub
#58 (comment).

@DBassel

This comment has been minimized.

Copy link

commented Feb 10, 2016

+1

@Squidies

This comment has been minimized.

Copy link

commented Feb 10, 2016

I actually got to this issue because I wanted to check that gulp init wasn't already a defined function. The reason being is I want to use init as a way to initialize my project such as copy front-end dependencies to respective folders, compile initial sass, etc.

I am in support of a command to create a limited gulpfile.js file, but would like to see init remain available to roll my own initial gulp install configs.

@MatheusRV

This comment was marked as spam.

Copy link

commented Oct 26, 2018

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.