Skip to content

Commit 55a861f

Browse files
committed
upd readme
1 parent 6421e42 commit 55a861f

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

README-RU.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
## Когда этот плагин использовать?
2121

22-
___Он не предназначен для использования в пайпах gulp потока___
22+
___Плагин не предназначен для использования в "пайпах" gulp потока___
2323

2424
_Если ваши плагины могут дать обратные вызовы после их работы,_
25-
_с информацией о включенных файлах или если вы знаете, как это сделать самостоятельно - это для вас_
25+
_с информацией о включенных файлах или если Вы знаете, как это сделать самостоятельно - это для Вас_
2626

2727
## Для чего этот плагин?
2828

29-
Предположим, что у вас есть что-то вроде этой файловой структуры в вашем проекте
29+
Предположим, что у Вас есть что-то вроде этой файловой структуры в Вашем проекте
3030

3131
``` shell
3232
├─┬ project-sources/
@@ -55,14 +55,14 @@ _с информацией о включенных файлах или если
5555
│ │ └── trigger-my-compilation-when-it-need-from-other-task.file
5656
```
5757

58-
У вас есть 5 файлов, которые должны быть трансформированы / скомпилированы и повторно собраны, когда это ДЕЙСТВИТЕЛЬНО нужно в процесск инкрементальных сборок. И если вы меняете файлы, которые затрагивают только один или два из них, нет необходимости воссоздавать все остальные. Но как это сделать?
58+
У Вас есть 5 файлов, которые должны быть трансформированы / скомпилированы и повторно собраны, когда это ДЕЙСТВИТЕЛЬНО нужно в процессе инкрементальных сборок. И если Вы меняете файлы, которые затрагивают только один или два из них, нет необходимости воссоздавать все остальные. Но как это сделать?
5959

60-
Конечно, вы можете создавать 5 или более задач с разными исходными параметрами и для каждого помещать отдельного наблюдателя (`gulp.watch ()` или какой нибудь плагин для этого), но этот подход не очень удобен в случае изменения зависимостей, отключения или включения импортов файлы и т.д. Вы должны, каждый раз, вручную переписывать свои задачи или их часть.
60+
Конечно, Вы можете создавать 5 или более задач с разными исходными параметрами и для каждого помещать отдельного наблюдателя (`gulp.watch()` или какой нибудь плагин для этого), но этот подход не очень удобен в случае изменения зависимостей, отключения или включения импортов и т.д. Вы должны, каждый раз, вручную переписывать свои задачи или их часть.
6161

6262
Еще один вариант - поставить `watch` на все файлы которые у Вас есть, чтобы не переписывать что-либо, но это в корне убивает нашу цель, которая заключается в оптимизации и ускорении процесса работы, только с теми файлами которые действительно нужны в данный момент.
6363

64-
_Наше предложение. Посмотрите на всю ситуацию под другим углом.
65-
Если что-то происходит с подключенными файлами - они должны сообщать об этом файлам, в которых они используются_
64+
_Наше предложение. Посмотрите на всю ситуацию под другим углом.
65+
Если что-то происходит с подключенными файлами - они должны сообщать об этом файлам, в которых они используются!_
6666

6767
__Пример__
6868

@@ -99,34 +99,33 @@ const wnt2 = watchAndTouch(gulp);
9999
// about the included files there
100100
import renderPlugin from 'some-gulp-plugin';
101101

102-
103102
export function renderTask1 () {
104-
return gulp.src('sources-1/*.file') // yes that's all source you need ))
105-
.pipe(renderPlugin({
106-
option1: 'value1',
107-
option2: 'value2',
108-
afterRenderCallback: function(file, result, stats) {
109-
let includedSources = stats.includedFiles;
110-
let pathToCurrentFile = file.path;
111-
let uniqFileKey = pathToCurrentFile.replace(/\\|\/|\.|\s|/g, '_');
112-
113-
let isChanged = wnt1(uniqFileKey, pathToCurrentFile, includedSources);
114-
if (isChanged) { // an example
115-
console.log( `${ file.relative } change dependencies:\n${ includedSources.join('\n') }` );
116-
}
117-
}
118-
}))
103+
return gulp.src('sources-1/*.file') // yes that's all source you need ))
104+
.pipe(renderPlugin({
105+
option1: 'value1',
106+
option2: 'value2',
107+
afterRenderCallback: function(file, result, stats) {
108+
let includedSources = stats.includedFiles;
109+
let pathToCurrentFile = file.path;
110+
let uniqFileKey = pathToCurrentFile.replace(/\\|\/|\.|\s|/g, '_');
111+
112+
let isChanged = wnt1(uniqFileKey, pathToCurrentFile, includedSources);
113+
if (isChanged) { // an example
114+
console.log( `${ file.relative } change dependencies:\n${ includedSources.join('\n') }` );
115+
}
116+
}
117+
}))
119118
}
120119

121120
// or
122121
// ==============
123122

124123
const analyseFn = () => {
125-
// some actions that you know how to write
126-
// for analyse your files for getting information
127-
// about the included files there
128-
// on done call
129-
wnt2(uniqueKey, touchSrc, watchingSrc);
124+
// some actions that you know how to write
125+
// for analyse your files for getting information
126+
// about the included files there
127+
// on done call
128+
wnt2(uniqueKey, touchSrc, watchingSrc);
130129
};
131130

132131
```

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ Suppose that you have something like this file structure in your project
5757

5858
You have 5 files which must be rendered / compiled, and re-assembled when it REALLY needs in incremental builds. And if you change files that affect only one or two of them, there is no need to re-create all the others. But how to do that?
5959

60-
Of course, you can create 5 or more tasks with different source parameters and for each put an individual observer (gulp.watch() or some plugin for watching) - but this approach is not very convenient in case of changing dependencies, disable or enable imported files, etc. You need to manually rewrite each time your tasks or part of them
60+
Of course, you can create 5 or more tasks with different source parameters and for each put an individual observer (`gulp.watch()` or some plugin for watching) - but this approach is not very convenient in case of changing dependencies, disable or enable imported files, etc. You need to manually rewrite each time your tasks or part of them
6161

6262
Another option is to put an `watch` on all the files you have to not overwrite anything, but this completely kills our goal, which is to optimize and speed up the process of work, only with those files that are really needed at that moment.
6363

6464
_Our offer. Look at the whole situation from a different angle.
65-
If something happens to the connected files - they must signal about this to the files in which they are used_
65+
If something happens to the connected files - they must signal about this to the files in which they are used!_
6666

6767
__Example__
6868

@@ -99,34 +99,33 @@ const wnt2 = watchAndTouch(gulp);
9999
// about the included files there
100100
import renderPlugin from 'some-gulp-plugin';
101101

102-
103102
export function renderTask1 () {
104-
return gulp.src('sources-1/*.file') // yes that's all source you need ))
105-
.pipe(renderPlugin({
106-
option1: 'value1',
107-
option2: 'value2',
108-
afterRenderCallback: function(file, result, stats) {
109-
let includedSources = stats.includedFiles;
110-
let pathToCurrentFile = file.path;
111-
let uniqFileKey = pathToCurrentFile.replace(/\\|\/|\.|\s|/g, '_');
112-
113-
let isChanged = wnt1(uniqFileKey, pathToCurrentFile, includedSources);
114-
if (isChanged) { // an example
115-
console.log( `${ file.relative } change dependencies:\n${ includedSources.join('\n') }` );
116-
}
117-
}
118-
}))
103+
return gulp.src('sources-1/*.file') // yes that's all source you need ))
104+
.pipe(renderPlugin({
105+
option1: 'value1',
106+
option2: 'value2',
107+
afterRenderCallback: function(file, result, stats) {
108+
let includedSources = stats.includedFiles;
109+
let pathToCurrentFile = file.path;
110+
let uniqFileKey = pathToCurrentFile.replace(/\\|\/|\.|\s|/g, '_');
111+
112+
let isChanged = wnt1(uniqFileKey, pathToCurrentFile, includedSources);
113+
if (isChanged) { // an example
114+
console.log( `${ file.relative } change dependencies:\n${ includedSources.join('\n') }` );
115+
}
116+
}
117+
}))
119118
}
120119

121120
// or
122121
// ==============
123122

124123
const analyseFn = () => {
125-
// some actions that you know how to write
126-
// for analyse your files for getting information
127-
// about the included files there
128-
// on done call
129-
wnt2(uniqueKey, touchSrc, watchingSrc);
124+
// some actions that you know how to write
125+
// for analyse your files for getting information
126+
// about the included files there
127+
// on done call
128+
wnt2(uniqueKey, touchSrc, watchingSrc);
130129
};
131130

132131
```

0 commit comments

Comments
 (0)