How to use modernizr - 10 common examples

To help you get started, we’ve selected a few modernizr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tvly / tvly-web / src / view / HLSPlayer.vue View on Github external
api.on('fullscreen', () => {
        if (Modernizr.lockorientation) {
          try {
            Modernizr.prefixed('lockOrientation', screen)('landscape');
          } catch (e) {
            console.warn('lockOrientation is not supported on this browser.');
            // the device does not support rotation
          }
        } else if (Modernizr.orientationlock) {
          screen.orientation.lock('landscape').catch(() => {
            console.warn('orientation.lock is not supported on this chrome.');
          });
        }
        this.applyRatio();
      });
      api.on('fullscreen-exit', () => {
github tvly / tvly-web / src / view / HLSPlayer.vue View on Github external
api.on('fullscreen', () => {
        if (Modernizr.lockorientation) {
          try {
            Modernizr.prefixed('lockOrientation', screen)('landscape');
          } catch (e) {
            console.warn('lockOrientation is not supported on this browser.');
            // the device does not support rotation
          }
        } else if (Modernizr.orientationlock) {
          screen.orientation.lock('landscape').catch(() => {
            console.warn('orientation.lock is not supported on this chrome.');
          });
        }
        this.applyRatio();
      });
      api.on('fullscreen-exit', () => {
github tvly / tvly-web / src / view / HLSPlayer.vue View on Github external
api.on('fullscreen', () => {
        if (Modernizr.lockorientation) {
          try {
            Modernizr.prefixed('lockOrientation', screen)('landscape');
          } catch (e) {
            console.warn('lockOrientation is not supported on this browser.');
            // the device does not support rotation
          }
        } else if (Modernizr.orientationlock) {
          screen.orientation.lock('landscape').catch(() => {
            console.warn('orientation.lock is not supported on this chrome.');
          });
        }
        this.applyRatio();
      });
      api.on('fullscreen-exit', () => {
github Modernizr / grunt-modernizr / src / builder.js View on Github external
if (minify) {
				utils.log.ok("Your file will be minified with UglifyJS".grey);
			}

			utils.log.writeln();
			utils.log.write("Building your customized Modernizr".bold.white);

			if (!_verbose) {
				_interval = setInterval(function () {
					utils.log.write(".".grey);
				}.bind(this), 200);
			}

			var modernizr = require("modernizr");

			modernizr.build(modernizrOptions, function (result) {
				utils.log.ok();
				clearInterval(_interval);

				// Write code to file
				this.builder.writeCodeToFile(result, settings);
				return deferred.resolve(modernizrOptions);
			}.bind(this));

			return deferred.promise;
		}
	};
github itgalaxy / webpack-modernizr-loader / index.js View on Github external
let userConfig = {};

  if (Object.keys(options).length === 0) {
    try {
      // eslint-disable-next-line import/no-dynamic-require, global-require
      userConfig = require(this.resource);
    } catch (error) {
      return callback(error);
    }
  } else {
    userConfig = options;
  }

  const config = Object.assign({}, userConfig);

  return modernizr.build(config, output => callback(null, wrapOutput(output)));
};
github Modernizr / customizr / src / builder.js View on Github external
if (minify) {
                    utils.log.ok("Your file will be minified with UglifyJS".grey);
                }

                utils.log.writeln();
                utils.log.write("Building your customized Modernizr".bold.white);

                _interval = setInterval(function () {
                    utils.log.write(".".grey);
                }.bind(this), 200);
            }

			var modernizr = require("modernizr");

			modernizr.build(modernizrOptions, function (result) {

                if(!settings.quiet) {
                    utils.log.write("...".grey);
                    utils.log.ok();

                    clearInterval(_interval);
                }

				// Write code to file
				if (settings.dest) {
					this.builder.writeCodeToFile(result, settings);
				}

				return deferred.resolve({
					result: result,
					options: modernizrOptions
github peerigon / modernizr-loader / index.js View on Github external
module.exports = function (config) {
    if (typeof this.cacheable === 'function') {
        this.cacheable();
    }

    var cb = this.async();

    // `this.exec` is deprecated
    var options = require(this.resourcePath) || {};

    modernizr.build(options, function (output) {
        cb(null, wrapOutput(output));
    });
};
github FriendsOfREDAXO / redaxo-mit-bimmelbam / gulpfile.js / tasks / modernizr.js View on Github external
const task = (done) => {

    modernizr.build(config.modernizr, (result) => {
        let dest = path.join(config.scripts.destinationFolder, '/modernizr.js');
        let options = {}; // see https://github.com/mishoo/UglifyJS2#minify-options
        let target = terser.minify(result, options).code;
        let targetSize = humanSize(Buffer.byteLength(target, 'utf8'));

        writefile(dest, target, () => {
            log(colors.white('Build a custom modernizr for you at ' + colors.magenta(dest + ', ' + targetSize)));
            return done();
        });
    });
};
github tvly / tvly-web / src / main.js View on Github external
// Flowplayer
import 'flowplayer/dist/skin/skin.css';

import './animation.css';

// Google Analytics
import analytics from 'universal-ga';
if (config.googleAnalytics) {
  analytics.initialize(config.googleAnalytics);
}

// offline-plugin
import * as OfflinePlugin from 'offline-plugin/runtime';
OfflinePlugin.install();

Modernizr.addTest(detects);

new Vue({
  el: '#app',
  components: {
    'auth-notification': AuthorizationNotification,
  },
  data: {
    channels: {
      Categories: [],
    },
    transition: '',
  },
  watch: {
    '$route'(to, from) {
      if (from.name === 'play') { // left play view
        this.transition = 'slide-right';
github Modernizr / modernizr-neue / server / routes / download.js View on Github external
'use strict';

// We have three possible outcomes when someone requests `/download`,

// 1. serve the compiled, static html file if in production
// 2. serve a compiled handlebars template on each request, in development
// 3. reply with a tar ball of a compiled version of Modernizr, if requested via bower

// this module determines the right one depending the circumstances

var Path = require('path');
var ETag = require('etag');
var Archiver = require('archiver');
var Modernizr = require('modernizr');
var modernizrMetadata = Modernizr.metadata();
var bowerJSON = require('../util/bowerJSON')();
var modernizrOptions = require('../util/modernizrOptions');
var _ = require(Path.join(__dirname, '..', '..', 'frontend', 'js', 'lodash.custom'));

// the `builderContent` step is super heavy, as a result, do not load it if we
// are in a production environment
if (process.env.NODE_ENV !== 'production') {
  var builderContent = require('../buildSteps/download');

  var downloaderConfig = {
    metadata: JSON.stringify(modernizrMetadata),
    options: JSON.stringify(modernizrOptions),
    builderContent: builderContent,
    scripts: [
      '/js/lodash.custom.js',
      '/js/modernizr.custom.js',