How to use the modernizr.metadata function in modernizr

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 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',
github Modernizr / modernizr-neue / gulpfile.js View on Github external
gulp.task('handlebars', function() {
  var posts = fs.readdirSync('./posts').reverse().map(blogPost);
  // `latestPosts` is used for the blog posts slugs on the homepage
  var latestPosts = posts.slice(0, 4);
  var metadata = modernizr.metadata();
  var docs = require('./server/util/docs');

  // `post` is used for the default blog post, on `/news`
  var post = posts.shift();
  post.posts = posts;

  var templateData = {
    metadata: JSON.stringify(metadata),
    options: JSON.stringify(modernizrOptions),
    builderContent: require('./server/buildSteps/download.js'),
    scripts: [
      '/js/lodash.custom.js',
      '/js/prod.js',
      '/lib/r.js/dist/r.js',
      '/lib/modernizr/lib/build.js'
    ],
github Modernizr / modernizr-neue / server / buildSteps / download.js View on Github external
'use strict';
var React = require('react');
var Modernizr = require('modernizr');

var DownloadModule = require('../../frontend/js/download/DownloadUI');
var downloadFactory = React.createFactory(DownloadModule);
var options = require('../util/modernizrOptions');

// render a static version of the `builder` for a faster initial render/script-less clients
module.exports = React.renderToString(downloadFactory({detects:Modernizr.metadata(), options: options}));
github Modernizr / customizr / test / generate-tests.js View on Github external
"use strict";

var fs = require("fs");
var cwd = process.cwd();
var path = require("path");

require("modernizr").metadata(function (metadata) {
	metadata = JSON.parse(metadata);

	var props = metadata.map(function (data) {
		return {
			name: data.name,
			path: data.amdPath.replace("test/", ""),
			property: data.property,
			cssclass: data.cssclass
		};
	});

	var jsProps = props.filter(function (data) {
		return data.property;
	});

	var jsTests = {};
github Modernizr / modernizr-neue / server / routes / dev.js View on Github external
handler: function(request, reply) {
      reply.view('pages/docs', {
        docs: docs(),
        features: modernizr.metadata(),
        team: team
      });
    }
  }, {
github sir-dunxalot / ember-cli-modernizr / lib / filter-files.js View on Github external
function ModernizrFilter(inputTrees, modernizrConfig) {
  var presetModernizrOptions = modernizrConfig.options;
  var requiredOptions = [];
  var metadata;

  if (!(this instanceof ModernizrFilter)) {
    return new ModernizrFilter(inputTrees, modernizrConfig);
  }

  inputTrees = inputTrees || {};
  metadata = modernizr.metadata();

  for (var option in presetModernizrOptions) {
    if (presetModernizrOptions[option]) {
      requiredOptions.push(option);
    }
  }

  this.classPrefix = modernizrConfig.classPrefix;
  this.inputTrees = inputTrees;
  this.metadata = metadata;
  this.modernizrConfig = modernizrConfig;
  this.requiredConfig = {
    classPrefix: modernizrConfig.classPrefix,
    'feature-detects': modernizrConfig['feature-detects'],
    options: requiredOptions,
  };