modernizr-loader
Advanced tools
Comparing version 0.0.5 to 1.0.0
@@ -0,1 +1,6 @@ | ||
## 1.0.0 | ||
- Don't attach Modernizr to window anymore | ||
- Allow using a JavaScript file for configuration | ||
## 0.0.5 | ||
@@ -2,0 +7,0 @@ |
@@ -10,3 +10,3 @@ "use strict"; | ||
"module.exports = window.Modernizr;\n" + | ||
"})(window);"; | ||
"})({});"; | ||
} | ||
@@ -21,5 +21,5 @@ | ||
modernizr.build(JSON.parse(config), function (output) { | ||
modernizr.build(this.exec(config, this.resource), function (output) { | ||
cb(null, wrapOutput(output)); | ||
}); | ||
}; |
{ | ||
"name": "modernizr-loader", | ||
"version": "0.0.5", | ||
"version": "1.0.0", | ||
"description": "use modernizr with webpack easily", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npm test" | ||
"test": "ava" | ||
}, | ||
@@ -20,4 +20,10 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^1.9.0", | ||
"eslint-config-peerigon": "^0.1.1" | ||
"ava": "^0.16.0", | ||
"eslint": "^3.3.1", | ||
"eslint-config-peerigon": "^6.0.0", | ||
"eslint-plugin-jsdoc": "^2.3.1", | ||
"json-loader": "^0.5.4", | ||
"modernizr": "^3.3.1", | ||
"temp": "^0.8.3", | ||
"webpack": "^1.13.2" | ||
}, | ||
@@ -24,0 +30,0 @@ "repository": { |
# modernizr-loader for webpack | ||
[![Build Status](https://travis-ci.org/peerigon/modernizr-loader.svg)](https://travis-ci.org/peerigon/modernizr-loader) [![devDependency Status](https://david-dm.org/peerigon/modernizr-loader/dev-status.svg)](https://david-dm.org/peerigon/modernizr-loader#info=devDependencies) [![peerDependency Status](https://david-dm.org/peerigon/modernizr-loader/peer-status.svg)](https://david-dm.org/peerigon/modernizr-loader#info=peerDependencies) | ||
## Installation | ||
``` | ||
$ npm install --save modernizr-loader | ||
$ npm install --save-dev modernizr modernizr-loader | ||
``` | ||
## Usage | ||
## Initialization | ||
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) | ||
You have to create a `.modernizrrc` configuration file and put your modernizr stuff in it. Like so | ||
@@ -26,22 +26,10 @@ | ||
Now you are able to require this `.modernizrrc` and get your built modernizr bundled with webpack. | ||
Full list of supported **"options"** and **"feature-detects"** can be found in Modernizr [config-all.json](https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json). | ||
```javascript | ||
require("!modernizr!./.modernizrrc") | ||
// => returns compiled modernizr build based on your configuration | ||
``` | ||
### Webpack config | ||
You are also able to import Modernizr as a module throughout your application like so: | ||
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) | ||
```javscript | ||
import Modernizr from 'modernizr'; | ||
Put the following code to your webpack config file: | ||
if (!Modernizr.promises) { | ||
// ... | ||
} | ||
``` | ||
### webpack config | ||
```javascript | ||
@@ -52,4 +40,8 @@ module.exports = { | ||
{ | ||
test: /\.modernizrrc$/, | ||
test: /\.modernizrrc.js$/, | ||
loader: "modernizr" | ||
}, | ||
{ | ||
test: /\.modernizrrc(\.json)?$/, | ||
loader: "modernizr!json" | ||
} | ||
@@ -66,2 +58,14 @@ ] | ||
### Usage | ||
Now you are able to import your custom Modernizr build as a module throughout your application like so: | ||
```javscript | ||
import Modernizr from 'modernizr'; | ||
if (!Modernizr.promises) { | ||
// ... | ||
} | ||
``` | ||
See the [Modernizr documentation](https://modernizr.com/docs) for all available options. | ||
@@ -71,2 +75,2 @@ | ||
Don't hesitate to create a pull request. Every contribution is appreciated. In development you can start the tests by calling `npm test`. | ||
Don't hesitate to create a pull request. Every contribution is appreciated. |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8220
15
108
0
73
0
8
1