text: 'use strict';
  
  var gulp = require('gulp');
  var realFavicon = require ('gulp-real-favicon');
  var fs = require('fs');
  
  // File where the favicon markups are stored
  var FAVICON_DATA_FILE = 'faviconData.json';
  
  // Generate the icons. This task takes a few seconds to complete.
  // You should run it at least once to create the icons. Then,
  // you should run it whenever RealFaviconGenerator updates its
  // package (see the check-for-favicon-update task below).
  gulp.task('generate-favicon', function (done) {
    realFavicon.generateFavicon({
      masterPicture: './src/nodeca_favicon.svg',
      dest: './static',
      iconsPath: '/',
      design: {
        ios: {
          pictureAspect: 'backgroundAndMargin',
          backgroundColor: '#ffffff',
          margin: '35%',
          assets: {
            ios6AndPriorIcons: false,
            ios7AndLaterIcons: true,
            precomposedIcons: true,
            declareOnlyDefaultIcon: true
          },
          appName: 'RC open'
        },
        desktopBrowser: {},
        windows: {
          pictureAspect: 'whiteSilhouette',
          backgroundColor: '#b91d47',
          onConflict: 'override',
          assets: {
            windows80Ie10Tile: false,
            windows10Ie11EdgeTiles: {
              small: false,
              medium: true,
              big: false,
              rectangle: false
            }
          },
          appName: 'RC open'
        },
        androidChrome: {
          pictureAspect: 'noChange',
          themeColor: '#ffffff',
          manifest: {
            name: 'RC open',
            display: 'standalone',
            orientation: 'notSet',
            onConflict: 'override',
            declared: true
          },
          assets: {
            legacyIcon: false,
            lowResolutionIcons: false
          }
        },
        safariPinnedTab: {
          pictureAspect: 'silhouette',
          themeColor: '#5bbad5'
        }
      },
      settings: {
        compression: 5,
        scalingAlgorithm: 'Mitchell',
        errorOnImageTooSmall: false
      },
      versioning: {
        paramName: 'v',
        paramValue: 'Q5wkom4MST'
      },
      markupFile: FAVICON_DATA_FILE
    }, function () {
      done();
    });
  });
  
  // Inject the favicon markups in your HTML pages. You should run
  // this task whenever you modify a page. You can keep this task
  // as is or refactor your existing HTML pipeline.
  gulp.task('inject-favicon-markups', function () {
    gulp.src([ './static/headers.html' ])
      .pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
      .pipe(gulp.dest('./static'));
  });
  
  // Check for updates on RealFaviconGenerator (think: Apple has just
  // released a new Touch icon along with the latest version of iOS).
  // Run this task from time to time. Ideally, make it part of your
  // continuous integration system.
  gulp.task('check-for-favicon-update', function (/*done*/) {
    var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
    realFavicon.checkForUpdates(currentVersion, function (err) {
      if (err) {
        throw err;
      }
    });
  });
  