Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/mq4-hover-shim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Rebert <code@rebertia.com>2015-01-03 10:51:34 +0300
committerChris Rebert <code@rebertia.com>2015-01-03 11:15:03 +0300
commit9ffc34ea5c5e3a3db8af1b357a3b71594e0c9c51 (patch)
tree6bc02a0f761385b07b3ca5ed29dede416ac1cf0d
parente167f0dd1cfc8710d9d07cb69a083d97b85b1f02 (diff)
Make npm module expose paths to client-side files; fixes #1
-rw-r--r--README.md9
-rw-r--r--package.json2
-rw-r--r--src/nodejs/index.js15
3 files changed, 23 insertions, 3 deletions
diff --git a/README.md b/README.md
index 0cc5509..09dc745 100644
--- a/README.md
+++ b/README.md
@@ -88,8 +88,13 @@ Unofficially supported:
* Internet Explorer Mobile <=10 - ??? (Theoretically: True negative)
## API
-### CSS postprocessor
-The module itself is a [PostCSS](https://github.com/postcss/postcss) processor object (that was returned from a call to the `postcss()` function). It requires that a `hoverSelectorPrefix` string option be provided. This string will be prepended to all selectors within `@media (hover: hover) {...}` blocks within the source CSS. It transforms the source CSS as described above.
+### Node.js module; CSS postprocessor
+The npm module has the following properties:
+* `postprocessor` - CSS postprocessor that transforms the source CSS as described above. A [PostCSS](https://github.com/postcss/postcss) processor object (that was returned from a call to the `postcss()` function). It requires that a `hoverSelectorPrefix` string option be provided; this string will be prepended to all selectors within `@media (hover: hover) {...}` blocks within the source CSS.
+* `featureDetector` - Each of this object's properties is a string filepath to a JavaScript file containing the browser-side feature detector in a particular JavaScript module format.
+ * `es6` - [ECMAScript 6 module](http://www.2ality.com/2014/09/es6-modules-final.html) format (this is the original from which the other versions are generated)
+ * `cjs` - [CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1) module format
+ * `umdGlobal` - "enhanced" [UMD](https://github.com/umdjs/umd) module format; exports a `window.mq4HoverShim` global if the JS environment has no module system (e.g. if included directly via `<script>` in current browsers); (generated via Browserify's `standalone` option)
### Browser-side feature detector
When used in a non-AMD non-CommonJS context, the module exports itself as a `mq4HoverShim` property on the global `window` object.
diff --git a/package.json b/package.json
index 123c22e..092fdd0 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"load-grunt-tasks": "^2.0.0",
"time-grunt": "^1.0.0"
},
- "main": "src/nodejs/postprocessor.js",
+ "main": "src/nodejs/index.js",
"files": [
"dist",
"src",
diff --git a/src/nodejs/index.js b/src/nodejs/index.js
new file mode 100644
index 0000000..96f0772
--- /dev/null
+++ b/src/nodejs/index.js
@@ -0,0 +1,15 @@
+/*eslint-env node */
+'use strict';
+
+var path = require('path');
+var CLIENT_SIDE_FEATURE_DETECTOR_FILENAME = 'mq4-hover-hover-shim.js';
+
+
+module.exports = {
+ postprocessor: require('./postprocessor'),
+ featureDetector: {
+ es6: path.join(__dirname, '../browser', CLIENT_SIDE_FEATURE_DETECTOR_FILENAME),
+ cjs: path.join(__dirname, '../../dist/cjs', CLIENT_SIDE_FEATURE_DETECTOR_FILENAME),
+ umdGlobal: path.join(__dirname, '../../dist/browser', CLIENT_SIDE_FEATURE_DETECTOR_FILENAME)
+ }
+};