function()

in website/gulpfile.js [65:134]


            function (data) {
              if (!data.contents || !/\.(html)$/.test(data.path)) {
                return this.emit("data", data);
              }

              var contents = data.contents.toString();
              contents = contents.replace(/{{version}}/g, VERSION);
              contents = contents.replace(
                /{{year}}/g,
                new Date().getFullYear()
              );

              var allCSS = "";
              var tmpcontents = replaceWithRelativeResource(
                data.path,
                contents,
                /<link data-inline="yes-please" href="([^"]+)".*/g,
                function (m0, fileContents) {
                  allCSS += fileContents.toString("utf8");
                  return "";
                }
              );
              tmpcontents = tmpcontents.replace(/<script.*/g, "");
              tmpcontents = tmpcontents.replace(/<link.*/g, "");

              waiting++;
              uncss(
                tmpcontents,
                { raw: allCSS },
                function (err, output) {
                  waiting--;

                  if (!err) {
                    output = new CleanCSS().minify(output).styles;
                    var isFirst = true;
                    contents = contents.replace(
                      /<link data-inline="yes-please" href="([^"]+)".*/g,
                      function (_, m0) {
                        if (isFirst) {
                          isFirst = false;
                          return "<style>" + output + "</style>";
                        }
                        return "";
                      }
                    );
                  }

                  // Inline javascript
                  contents = replaceWithRelativeResource(
                    data.path,
                    contents,
                    /<script data-inline="yes-please" src="([^"]+)".*/g,
                    function (m0, fileContents) {
                      return (
                        "<script>" + fileContents.toString("utf8") + "</script>"
                      );
                    }
                  );

                  data.contents = Buffer.from(
                    contents.split(/\r\n|\r|\n/).join("\n")
                  );
                  this.emit("data", data);

                  if (done && waiting === 0) {
                    this.emit("end");
                  }
                }.bind(this)
              );
            },