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

gulp/tasks/html.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 25
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 25
rs 10
bpm 1
cpm 1
noi 0
1
module.exports = function (gulp, plugins, config) {
2
  return function htmlmin() {
3
    return gulp.src(config.build + '/*.html')
4
      .pipe(plugins.inject(gulp.src(['config.json']), {
5
        starttag: '<!-- inject:config -->',
6
        transform: function (filePath, file) {
7
          return '<script>var jsonData =' +
8
            file.contents.toString('utf8')
9
              .replace('<!-- inject:cache-breaker -->',
10
                Math.random().toString(12).substring(7)) +
11
            ';</script>'
12
            ;
13
        }
14
      }))
15
      .pipe(plugins.cacheBust({
16
        type: 'timestamp'
17
      }))
18
      .pipe(plugins.htmlmin({
19
        removeComments: true,
20
        collapseWhitespace: true,
21
        minifyJS: true
22
      }))
23
      .pipe(gulp.dest(config.build));
24
  };
25
};
26