A
A
Anton Schultz2020-03-11 14:16:36
npm
Anton Schultz, 2020-03-11 14:16:36

What is the principle of calling functions from a project?

When I write gulp task in the console
, my node starts looking in the modules for something called gulp, and then, if it finds it, it follows its instructions and looks for the gulpfile.js file and is it already looking for the task function in it?
I just call it all without node, but immediately with gulp

And what is it for?
"main": "gulp.js"
I don't have a file with that name.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
frontend queen, 2020-03-11
@arka33

tasks are described in gulpfile.js. depending on the directory in which you call the gulp command, this file will be searched. if the command was launched without arguments, only gulp, then default tasks will be executed to launch a specific task, it must be described, for examplegulp.task('default', ['watch']);

gulp.task('watch', ['sass', 'js', 'browser-sync'], function() {
  gulp.watch('app/sass/**/*.sass', ['sass']);
  gulp.watch(['libs/**/*.js', 'app/js/common.js'], ['js']);
  gulp.watch('app/*.html', browserSync.reload);
});

and then call by gulp taskName
for more details here
in the package.json file in "main": "script.js" the path to the project's entry point is indicated. if your npm scripts are not related to gulp, then do not care what is written there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question