Upgrade to PostCSS 8 #1

Closed
jtojnar wants to merge 0 commits from (deleted):postcss-8 into master
First-time contributor

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 2022-02-02 23:12:27 +01:00
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 2022-04-23 12:14:10 +02:00
jtojnar deleted branch postcss-8 2022-05-23 18:19:31 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
No description provided.