Skip to content

Commit b665499

Browse files
committed
正式版
1 parent cd674a4 commit b665499

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-simple-reset",
3-
"version": "1.0.5",
3+
"version": "1.1.0",
44
"description": "postcss-simple-reset is a postcss plugin to help you to reset your css via at-rules.",
55
"main": "lib/index.js",
66
"authors": [
@@ -26,7 +26,6 @@
2626
"babel-tape-runner": "^2.0.1",
2727
"eslint": "^2.4.0",
2828
"eslint-plugin-import": "^2.7.0",
29-
"promise-polyfill": "^6.0.2",
3029
"object-assign": "^3.0.0",
3130
"tap-spec": "^4.1.1",
3231
"tape": "^4.5.0",

src/index.js

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
import postcss from 'postcss';
22
import parser from 'postcss-value-parser';
33
import humps from 'humps';
4-
import Promise from 'promise-polyfill';
54
import resetCore from './reset-core';
65

7-
if (typeof window !== 'undefined') {
8-
window.Promise = window.Promise || Promise
9-
} else if (typeof global !== 'undefined') {
10-
global.Promise = global.Promise || Promise
11-
}
12-
136
const atRules = {
147
global(platefprm) {
158
return resetCore.resetGlobal(platefprm);
@@ -74,10 +67,6 @@ const stringifyNode = (node) => {
7467
}
7568
}
7669

77-
const isPromise = (obj) => {
78-
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
79-
}
80-
8170
module.exports = postcss.plugin('postcss-simple-reset', () => {
8271
return (root) => {
8372
let promises = [];
@@ -99,11 +88,8 @@ module.exports = postcss.plugin('postcss-simple-reset', () => {
9988
});
10089

10190
let promise = ruleFun(...params);
91+
promises.push(promise);
10292

103-
if (isPromise(promise)) {
104-
promises.push(promise);
105-
}
106-
10793
promise.then((resolve) => {
10894
if (typeof resolve === 'object') {
10995
applyRuleSetToNode(resolve, rule.parent, rule);

0 commit comments

Comments
 (0)