icss-utils
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -17,7 +17,9 @@ Object.defineProperty(exports, "__esModule", { | ||
var extractICSS = function extractICSS(css) { | ||
var removeRules = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
var icssImports = {}; | ||
var icssExports = {}; | ||
css.each(function (node) { | ||
if (node.type === 'rule') { | ||
if (node.selector.slice(0, 7) === ':import') { | ||
if (node.type === "rule") { | ||
if (node.selector.slice(0, 7) === ":import") { | ||
var matches = importPattern.exec(node.selector); | ||
@@ -28,8 +30,12 @@ if (matches) { | ||
icssImports[path] = aliases; | ||
node.remove(); | ||
if (removeRules) { | ||
node.remove(); | ||
} | ||
} | ||
} | ||
if (node.selector === ':export') { | ||
if (node.selector === ":export") { | ||
Object.assign(icssExports, getDeclsObject(node)); | ||
node.remove(); | ||
if (removeRules) { | ||
node.remove(); | ||
} | ||
} | ||
@@ -36,0 +42,0 @@ } |
{ | ||
"name": "icss-utils", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "ICSS utils for postcss ast", | ||
@@ -13,10 +13,18 @@ "main": "lib/index.js", | ||
"precommit": "lint-staged", | ||
"prepublish": "yarn run test && yarn run build" | ||
"prepublish": "yarn test && yarn run build" | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"prettier --single-quote --no-semi --write", | ||
"eslint", | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"extends": "eslint:recommended" | ||
}, | ||
"babel": { | ||
@@ -36,3 +44,3 @@ "presets": [ | ||
"type": "git", | ||
"url": "git+https://github.com/css-modules/icss-replace-symbols.git" | ||
"url": "git+https://github.com/css-modules/icss-utils.git" | ||
}, | ||
@@ -48,5 +56,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/css-modules/icss-replace-symbols/issues" | ||
"url": "https://github.com/css-modules/icss-utils/issues" | ||
}, | ||
"homepage": "https://github.com/css-modules/icss-replace-symbols#readme", | ||
"homepage": "https://github.com/css-modules/icss-utils#readme", | ||
"dependencies": { | ||
@@ -59,2 +67,3 @@ "postcss": "^6.0.1" | ||
"babel-preset-env": "^1.5.1", | ||
"eslint": "^3.19.0", | ||
"husky": "^0.13.3", | ||
@@ -61,0 +70,0 @@ "jest": "^20.0.3", |
@@ -28,5 +28,5 @@ [![Build Status](https://travis-ci.org/css-modules/icss-utils.svg)](https://travis-ci.org/css-modules/icss-utils) | ||
## extractICSS(css) | ||
## extractICSS(css, removeRules = true) | ||
Extracts and remove from PostCSS tree `:import` and `:export` statements. | ||
Extracts and remove (if removeRules is equal true) from PostCSS tree `:import` and `:export` statements. | ||
@@ -33,0 +33,0 @@ ```js |
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
8403
146
8