Coder Social home page Coder Social logo

geoloeg / modernizr-element Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 2.63 MB

[Polymer 1.x] A feature detection element powered by `Modernizr`

License: MIT License

HTML 1.82% JavaScript 98.18%
polymer polymer-element webcomponents feature-detection modernizr

modernizr-element's Introduction

Published on webcomponents.org

<modernizr-element>

Descripton

A feature detection element based on modernizr.

Install

Install the component using Bower:

$ bower install modernizr-element --save

Generating your modernizr-custom.js file

In order for the element to provide its feature detection functionality, a javascript file named modernizr-custom.js need to be generated. This file will include all the tests available for feature detection by the modernizr-element. Once the file has been produced, you will need to copy the file in the same folder as the modernizr-element.html. (e.g. path/to/bower_components/modernizr/)

There are several ways to produce the modernizr-custom.js file:

  1. Using the Modernizr website download feature.
  2. Using modernizr in your gulp file:
gulp.task('modernizr', function(cb) {
  var detects = [
    'adownload',
    'blobconstructor',
    'flash'
  ].join();

  var output = 'frontend/js/modernizr.custom.js';

  return exec('./node_modules/.bin/modernizr -f ' + detects + ' -d ' + output,
    cb
  );
});
  1. Using the gulp-modernizr

Note: the element contains by default a full build which should NOT be used in production.

Usage

Import Custom Element:

<link rel="import" href="bower_components/modernizr-element/modernizr-element.html">

And then use it:

<modernizr-element geolocation="{{_geolocation}}"></modernizr-element>
<p>Feature geolocation is : {{_geolocation}}</p>

See the Documentation for more options.

More Demos

https://geoloeg.github.io/modernizr-element/

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

modernizr-element's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

datatonic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.