postcss-will-change
Advanced tools
Comparing version 3.0.0 to 4.0.0
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 4.0 | ||
* Moved to PostCSS 8. | ||
* Moved `postcss` to `peerDependencies`. | ||
## 3.0 | ||
@@ -5,0 +9,0 @@ * Use PostCSS 7. |
27
index.js
@@ -1,13 +0,16 @@ | ||
var postcss = require('postcss') | ||
module.exports = postcss.plugin('postcss-will-change', function () { | ||
return function (css) { | ||
css.walkDecls('will-change', function (decl) { | ||
var already = decl.parent.some(function (i) { | ||
return i.type === 'decl' && i.prop === 'backface-visibility' | ||
}) | ||
if (already) return | ||
decl.cloneBefore({ prop: 'backface-visibility', value: 'hidden' }) | ||
}) | ||
module.exports = () => { | ||
return { | ||
postcssPlugin: 'postcss-will-change', | ||
Declaration: { | ||
'will-change': decl => { | ||
let already = decl.parent.some(i => { | ||
return i.type === 'decl' && i.prop === 'backface-visibility' | ||
}) | ||
if (!already) { | ||
decl.cloneBefore({ prop: 'backface-visibility', value: 'hidden' }) | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
module.exports.postcss = true |
{ | ||
"name": "postcss-will-change", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "PostCSS plugin to insert 3D hack before will-change property", | ||
@@ -15,5 +15,8 @@ "keywords": [ | ||
"repository": "postcss/postcss-will-change", | ||
"dependencies": { | ||
"postcss": "^7.0.2" | ||
"engines": { | ||
"node": ">=10.0" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.0.3" | ||
} | ||
} |
@@ -1,6 +0,6 @@ | ||
# PostCSS Will Change [![Build Status][ci-img]][ci] | ||
# PostCSS Will Change | ||
<img align="right" width="95" height="95" | ||
<img align="right" width="135" height="95" | ||
title="Philosopher’s stone, logo of PostCSS" | ||
src="http://postcss.github.io/postcss/logo.svg"> | ||
src="https://postcss.org/logo-leftp.svg"> | ||
@@ -23,8 +23,6 @@ [PostCSS] plugin to insert 3D hack before [will-change] property. | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[ci-img]: https://travis-ci.org/postcss/postcss-will-change.svg | ||
[ci]: https://travis-ci.org/postcss/postcss-will-change | ||
```css | ||
.foo { | ||
will-change: transform; | ||
will-change: transform; | ||
} | ||
@@ -35,13 +33,39 @@ ``` | ||
.foo { | ||
backface-visibility: hidden; | ||
will-change: transform; | ||
backface-visibility: hidden; | ||
will-change: transform; | ||
} | ||
``` | ||
<a href="https://evilmartians.com/?utm_source=postcss-will-change"> | ||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" | ||
alt="Sponsored by Evil Martians" width="236" height="54"> | ||
</a> | ||
## Usage | ||
```js | ||
postcss([ require('postcss-will-change') ]) | ||
**Step 1:** Install plugin: | ||
```sh | ||
npm install --save-dev postcss postcss-will-change | ||
``` | ||
See [PostCSS] docs for examples for your environment. | ||
**Step 2:** Check you project for existed PostCSS config: `postcss.config.js` | ||
in the project root, `"postcss"` section in `package.json` | ||
or `postcss` in bundle config. | ||
If you do not use PostCSS, add it according to [official docs] | ||
and set this plugin in settings. | ||
**Step 3:** Add the plugin to plugins list: | ||
```diff | ||
module.exports = { | ||
plugins: [ | ||
+ require('postcss-will-change'), | ||
require('autoprefixer') | ||
] | ||
} | ||
``` | ||
[official docs]: https://github.com/postcss/postcss#usage |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4194
16
70
+ Addednanoid@3.3.8(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.4.49(transitive)
+ Addedsource-map-js@1.2.1(transitive)
- Removedpostcss@^7.0.2
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedsource-map@0.6.1(transitive)