Skip to content

Commit f2460bf

Browse files
committed
Update to PostCSS 8
1 parent f81fb37 commit f2460bf

File tree

5 files changed

+2675
-15
lines changed

5 files changed

+2675
-15
lines changed

.eslintrc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ root: true
22
extends: eslint:recommended
33

44
parserOptions:
5-
ecmaVersion: 5
5+
ecmaVersion: 6
66

77
env:
88
commonjs: true

index.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* Module dependencies.
33
*/
4-
var postcss = require("postcss")
54
var parser = require("postcss-value-parser")
65
var colorFn = require("css-color-function")
76
var helpers = require("postcss-message-helpers")
@@ -13,11 +12,12 @@ var defaultOptions = {
1312
/**
1413
* PostCSS plugin to transform color()
1514
*/
16-
module.exports = postcss.plugin("postcss-color-function", function(options) {
15+
module.exports = function(options) {
1716
options = Object.assign({}, defaultOptions, options)
1817

19-
return function(style, result) {
20-
style.walkDecls(function transformDecl(decl) {
18+
return {
19+
postcssPlugin: "postcss-color-function",
20+
Declaration(decl, {result}) {
2121
if (!decl.value || decl.value.indexOf("color(") === -1) {
2222
return
2323
}
@@ -50,9 +50,11 @@ module.exports = postcss.plugin("postcss-color-function", function(options) {
5050
index: decl.index,
5151
})
5252
}
53-
})
53+
},
5454
}
55-
})
55+
}
56+
57+
module.exports.postcss = true
5658

5759
/**
5860
* Transform color() to rgb()

0 commit comments

Comments
 (0)