Completed
Pull Request — develop (#110)
by Xaver
01:03
created

gulp/tasks/htmlMin.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 28
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 3
c 1
b 0
f 0
nc 1
mnd 0
bc 3
fnc 3
dl 0
loc 28
rs 10
bpm 1
cpm 1
noi 2
1
module.exports = function (gulp, plugins, config) {
0 ignored issues
show
Unused Code introduced by
The parameter config is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
2
  return function htmlmin() {
3
    const fs = require('fs');
0 ignored issues
show
Unused Code introduced by
The constant fs seems to be never used. Consider removing it.
Loading history...
4
5
    return gulp.src('build/*.html')
6
      .pipe(plugins.inject(gulp.src(['config.json']), {
7
        starttag: '<!-- inject:config -->',
8
        transform: function (filePath, file) {
9
          return '<script>var jsonData =' +
10
            file.contents.toString('utf8')
11
              .replace('<!-- inject:cache-breaker -->',
12
                Math.random().toString(12).substring(7)) +
13
            ';</script>'
14
            ;
15
        }
16
      }))
17
      .pipe(plugins.kyhInlineSource({ compress: false }))
18
      .pipe(plugins.cacheBust({
19
        type: 'timestamp'
20
      }))
21
      .pipe(plugins.htmlmin({
22
        removeComments: true,
23
        collapseWhitespace: true,
24
        minifyJS: true
25
      }))
26
      .pipe(gulp.dest('build'));
27
  };
28
};
29