Upgrade to PostCSS 8 #1

Closed
jtojnar wants to merge 0 commits from <deleted>:postcss-8 into master

The PostCSS 7’ postcss.plugin method has been deprecated in favour of manually created function returning an object containing various event handling functions like Once, Declaration, Rule and many more.

- module.exports = postcss.plugin('postcss-dark-theme-class', (opts = {}) => {
-   checkOpts(opts)
-   return (root, result) => {
      root.walkAtRules(atrule => { … })
-   }
- })
+ module.exports = (opts = {}) => {
+   checkOpts(opts)
+   return {
+     postcssPlugin: 'postcss-dark-theme-class',
+     Once (root, { result }) {
        root.walkAtRules(atrule => { … })
+     }
+   }
+ }
+ module.exports.postcss = true

https://evilmartians.com/chronicles/postcss-8-plugin-migration

The PostCSS 7’ `postcss.plugin` method has been deprecated in favour of manually created function returning an object containing various event handling functions like `Once`, `Declaration`, `Rule` and many more. ```patch - module.exports = postcss.plugin('postcss-dark-theme-class', (opts = {}) => { - checkOpts(opts) - return (root, result) => { root.walkAtRules(atrule => { … }) - } - }) ``` ```patch + module.exports = (opts = {}) => { + checkOpts(opts) + return { + postcssPlugin: 'postcss-dark-theme-class', + Once (root, { result }) { root.walkAtRules(atrule => { … }) + } + } + } + module.exports.postcss = true ``` https://evilmartians.com/chronicles/postcss-8-plugin-migration
jtojnar added 1 commit 3 years ago
17e76d772c Upgrade to PostCSS 8
The PostCSS 7’ `postcss.plugin` method has been deprecated in favour of manually created function returning an object containing various event handling functions like `Once`, `Declaration`, `Rule` and many more.

```patch
- module.exports = postcss.plugin('postcss-dark-theme-class', (opts = {}) => {
-   checkOpts(opts)
-   return (root, result) => {
      root.walkAtRules(atrule => { … })
-   }
- })
```

```patch
+ module.exports = (opts = {}) => {
+   checkOpts(opts)
+   return {
+     postcssPlugin: 'postcss-dark-theme-class',
+     Once (root, { result }) {
        root.walkAtRules(atrule => { … })
+     }
+   }
+ }
+ module.exports.postcss = true
```

https://evilmartians.com/chronicles/postcss-8-plugin-migration
Owner

Thanks, and sorry for the slow resolution! I've merged your PR (manually) and changed the validator to accept both old and new plugins - it's now published as @validatem/is-postcss-plugin 0.1.1.

Thanks, and sorry for the slow resolution! I've merged your PR (manually) and changed the validator to accept both old *and* new plugins - it's now published as `@validatem/is-postcss-plugin 0.1.1`.
joepie91 closed this pull request 3 years ago
jtojnar deleted branch postcss-8 3 years ago
This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: validatem/is-postcss-plugin#1
Loading…
There is no content yet.