@modular-css/processor
Advanced tools
Comparing version 16.0.0 to 16.1.0
@@ -6,2 +6,11 @@ # Change Log | ||
<a name="16.1.0"></a> | ||
# [16.1.0](https://github.com/tivac/modular-css/compare/v16.0.0...v16.1.0) (2018-09-21) | ||
**Note:** Version bump only for package @modular-css/processor | ||
<a name="16.0.0"></a> | ||
@@ -8,0 +17,0 @@ # [16.0.0](https://github.com/tivac/modular-css/compare/v15.0.1...v16.0.0) (2018-09-01) |
{ | ||
"name": "@modular-css/processor", | ||
"version": "16.0.0", | ||
"version": "16.1.0", | ||
"description": "A streamlined reinterpretation of CSS Modules", | ||
@@ -38,3 +38,3 @@ "main": "./processor.js", | ||
}, | ||
"gitHead": "7352a0ec6ef46ebf4c05b26c154c1d4981a11e89" | ||
"gitHead": "64e8e1574930c873aec9e08fa9872e8e2d918661" | ||
} |
@@ -25,27 +25,24 @@ @modular-css/processor [![NPM Version](https://img.shields.io/npm/v/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) [![NPM License](https://img.shields.io/npm/l/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) [![NPM Downloads](https://img.shields.io/npm/dm/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) | ||
```js | ||
var Processor = require("@modular-css/processor"), | ||
processor = new Processor({ | ||
// See "API Options" for valid options to pass to the Processor constructor | ||
}); | ||
const Processor = require("@modular-css/processor"); | ||
const processor = new Processor({ | ||
// See "API Options" for valid options to pass to the Processor constructor | ||
}); | ||
// Add entries, either from disk using .file() or as strings with .string() | ||
Promise.all([ | ||
processor.file("./entry.css").then(function(result) { | ||
// result now contains | ||
// .exports - Scoped selector mappings | ||
// .files - metadata about the file hierarchy | ||
}), | ||
processor.string("./fake-file.css", ".class { color: red; }") | ||
]) | ||
.then(function() { | ||
// Once all files are added, use .output() to get at the rewritten CSS | ||
return processor.output(); | ||
}) | ||
.then(function(result) { | ||
// Output CSS lives on the .css property | ||
result.css; | ||
// Source map (if requested) lives on the .map property | ||
result.map; | ||
}); | ||
const result = await processor.file("./entry.css"); | ||
// result contains | ||
// .exports - Scoped selector mappings | ||
// .files - metadata about the file hierarchy | ||
await processor.string("./fake-file.css", ".class { color: red; }"); | ||
// Once all files are added, use .output() to get at the rewritten CSS | ||
const results = await processor.output(); | ||
// Output CSS lives on the .css property | ||
results.css; | ||
// Source map (if requested) lives on the .map property | ||
results.map; | ||
``` | ||
@@ -63,6 +60,10 @@ | ||
### `.output([files])` | ||
### `.output({ args })` | ||
Returns a promise. Finalize processing of all added CSS and create combined CSS output file. Optionally allows for combining a subset of the loaded files by passing a single file or array of files. | ||
Returns a promise. Finalize processing of all added CSS and create combined CSS output file. | ||
Passing `files` as part of `args` will result in getting back combined output CSS just for the listed files and their dependencies. | ||
Passing `to` as part of `args` will be passed along to teh `after` and `done` hooks for proper path adjustment in maps & any plugins that use it. | ||
**WARNING**: Calling `.output()` before any preceeding `.file(...)`/`.string(...)` calls have resolved their returned promises will return a rejected promise. See [usage](#usage) for an example of correct usage. | ||
@@ -69,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76575
216