Skip to content

Update to PostCSS 8 #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ root: true
extends: eslint:recommended

parserOptions:
ecmaVersion: 5
ecmaVersion: 6

env:
commonjs: true
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sudo: false
language: node_js
node_js:
- "6"
- "4"
- 14
- 12
- 10
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Module dependencies.
*/
var postcss = require("postcss")
var parser = require("postcss-value-parser")
var colorFn = require("css-color-function")
var helpers = require("postcss-message-helpers")
Expand All @@ -13,11 +12,12 @@ var defaultOptions = {
/**
* PostCSS plugin to transform color()
*/
module.exports = postcss.plugin("postcss-color-function", function(options) {
module.exports = function(options) {
options = Object.assign({}, defaultOptions, options)

return function(style, result) {
style.walkDecls(function transformDecl(decl) {
return {
postcssPlugin: "postcss-color-function",
Declaration(decl, {result}) {
if (!decl.value || decl.value.indexOf("color(") === -1) {
return
}
Expand Down Expand Up @@ -50,9 +50,11 @@ module.exports = postcss.plugin("postcss-color-function", function(options) {
index: decl.index,
})
}
})
},
}
})
}

module.exports.postcss = true

/**
* Transform color() to rgb()
Expand Down
Loading