New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

modernizr-loader

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modernizr-loader

use modernizr with webpack easily

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.8K
increased by13.24%
Maintainers
2
Weekly downloads
 
Created
Source

modernizr-loader for webpack

Build Status devDependency Status peerDependency Status

Installation

$ npm install --save-dev modernizr modernizr-loader

Initialization

You have to create a .modernizrrc configuration file and put your modernizr stuff in it. Like so

// .modernizrrc
{
  "minify": true,
  "options": [
    "setClasses"
  ],
  "feature-detects": []
}

Full list of supported "options" and "feature-detects" can be found in Modernizr config-all.json.

Webpack config

Documentation: Using loaders

Put the following code to your webpack config file:

module.exports = {
  module: {
    loaders: [
      {
        test: /\.modernizrrc.js$/,
        loader: "modernizr"
      },
      {
        test: /\.modernizrrc(\.json)?$/,
        loader: "modernizr!json"
      }
    ]
  },
  resolve: {
    alias: {
      modernizr$: path.resolve(__dirname, "path/to/.modernizrrc")
    }
  }
}

Usage

Now you are able to import your custom Modernizr build as a module throughout your application like so:

import Modernizr from 'modernizr';

if (!Modernizr.promises) {
    // ...
}

See the Modernizr documentation for all available options.

Contribution

Don't hesitate to create a pull request. Every contribution is appreciated.

Keywords

FAQs

Package last updated on 12 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc