M
M
myskypesla2016-05-12 12:45:56
JavaScript
myskypesla, 2016-05-12 12:45:56

Is it possible to duplicate tasks?

Hello everyone, there is the following task .

var gulp = require('gulp');

gulp.task('registration', function () {
  return gulp.src('user/registration/index.html') // беру файл index.html из user/registration
                .pipe(gulp.dest('../dist/user/registration/')) // кладу его в dist/user/registration
});
gulp.task('default,  ['registration']); // запускаю gulp, всё ОК

Further, I will have many such pages as "registration", and each should have its own path, i.e. This is how I would do it manually:
gulp.task('selling', function () {
  return gulp.src('user/pages/selling.html')
                .pipe(gulp.dest('../dist/user/pages/'))
});
gulp.task('login', function () {
  return gulp.src('user/login/login.html')
                .pipe(gulp.dest('../dist/user/login/'))
});
gulp.task('default,  ['registration', 'selling', 'login']);

How can I make 1 universal task and variables that the task will take from, for example, "data.json" and insert paths by running just 1 gulp default task, so as not to do separate tasks for each page.
How it sounds in words: When starting gulp, take a variable from data.json and add a new task by the name of the variable, in which to write the path from the variable.
The project is complex and it is impossible to drop all html files into 1 folder.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question