postcss-import
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -0,1 +1,5 @@ | ||
# 3.2.0 - 2014-11-24 | ||
- Add `onImport` callback that offer a way to get list of imported files ([ref](https://github.com/postcss/postcss-import/issues/9)) | ||
# 3.1.0 - 2014-11-24 | ||
@@ -2,0 +6,0 @@ |
22
index.js
@@ -47,3 +47,16 @@ "use strict"; | ||
parseStyles(styles, options, insertRules) | ||
var importedFiles = {} | ||
if (options.from) { | ||
importedFiles[options.from] = { | ||
"": true | ||
} | ||
} | ||
var ignoredAtRules = [] | ||
parseStyles(styles, options, insertRules, importedFiles, ignoredAtRules) | ||
addIgnoredAtRulesOnTop(styles, ignoredAtRules) | ||
if (typeof options.onImport === "function") { | ||
options.onImport(Object.keys(importedFiles)) | ||
} | ||
} | ||
@@ -59,5 +72,2 @@ } | ||
function parseStyles(styles, options, cb, importedFiles, ignoredAtRules, media) { | ||
var isRoot = ignoredAtRules === undefined | ||
importedFiles = importedFiles || {} | ||
ignoredAtRules = ignoredAtRules || [] | ||
styles.eachAtRule(function checkAtRule(atRule) { | ||
@@ -72,6 +82,2 @@ if (atRule.name !== "import") { | ||
}) | ||
if (isRoot) { | ||
addIgnoredAtRulesOnTop(styles, ignoredAtRules) | ||
} | ||
} | ||
@@ -78,0 +84,0 @@ |
{ | ||
"name": "postcss-import", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "PostCSS plugin to import CSS files", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -71,3 +71,3 @@ # postcss-import [![Build Status](https://travis-ci.org/postcss/postcss-import.png)](https://travis-ci.org/postcss/postcss-import) | ||
#### encoding | ||
#### `encoding` | ||
@@ -79,3 +79,3 @@ Type: `String` | ||
#### path | ||
#### `path` | ||
@@ -88,3 +88,3 @@ Type: `String|Array` | ||
#### transform | ||
#### `transform` | ||
@@ -96,2 +96,9 @@ Type: `Function` | ||
#### `onImport` | ||
Type: `Function` | ||
Default: `null` | ||
Function called after the import process. Take one argument (array of imported files). | ||
#### Example with some options | ||
@@ -98,0 +105,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
14268
245
129