⛔️
DEPRECATED
Tailwind CSS 1.2 (released in February 2020) has utilities for scale, rotate, translate, skew, and transform origin, and contrary to this plugin, they are fully composable (e.g. a single element can have more than one transform type). It doesn’t have 3D transforms (translateZ
, translate3d
, scaleZ
, scale3d
, rotateX
, rotateY
, rotate3d
, perspective
, transform-style
, and backface-visibility
) but those are not very common and can be added to projects manually on a case-by-case basis.
Transforms Plugin for Tailwind CSS
Installation
npm install tailwindcss-transforms
Usage
// tailwind.config.js
module.exports = {
theme: {
transform: { // defaults to this value
'none': 'none',
},
transformOrigin: { // defaults to these values
't': 'top',
'tr': 'top right',
'r': 'right',
'br': 'bottom right',
'b': 'bottom',
'bl': 'bottom left',
'l': 'left',
'tl': 'top left',
},
translate: { // defaults to {}
'1/2': '50%',
'full': '100%',
'right-up': ['100%', '-100%'],
'3d': ['40px', '-60px', '-130px'],
},
scale: { // defaults to {}
'90': '0.9',
'100': '1',
'110': '1.1',
'-100': '-1',
'stretched-x': ['2', '0.5'],
'stretched-y': ['0.5', '2'],
'3d': ['0.5', '1', '2'],
},
rotate: { // defaults to {}
'90': '90deg',
'180': '180deg',
'270': '270deg',
'3d': ['0', '1', '0.5', '45deg'],
},
skew: { // defaults to {}
'-5': '-5deg',
'5': '5deg',
},
perspective: { // defaults to {}
'none': 'none',
'250': '250px',
'500': '500px',
'750': '750px',
'1000': '1000px',
},
perspectiveOrigin: { // defaults to these values
't': 'top',
'tr': 'top right',
'r': 'right',
'br': 'bottom right',
'b': 'bottom',
'bl': 'bottom left',
'l': 'left',
'tl': 'top left',
},
},
variants: { // all the following default to ['responsive']
transform: ['responsive'],
transformOrigin: ['responsive'],
translate: ['responsive'],
scale: ['responsive'],
rotate: ['responsive'],
skew: ['responsive'],
perspective: ['responsive'],
perspectiveOrigin: ['responsive'],
transformStyle: ['responsive'],
backfaceVisibility: ['responsive'],
transformBox: ['responsive'],
},
plugins: [
require('tailwindcss-transforms')({
'3d': false, // defaults to false
}),
],
};
This plugin generates the following utilities:
/* configurable with the "transform" theme object */
.transform-none {
transform: none;
}
/* configurable with the "transformOrigin" theme object */
.transform-[key] {
transform-origin: [value];
}
/* configurable with the "translate" theme object */
.translate-x-[key] {
transform: translateX([value]);
}
.translate-y-[key] {
transform: translateY([value]);
}
.translate-z-[key] { /* only if the "3d" option is true */
transform: translateZ([value]);
}
/* when the key starts with a minus sign: */
.-translate-x-[key] {
transform: translateX([value]);
}
.-translate-y-[key] {
transform: translateY([value]);
}
.-translate-z-[key] { /* only if the "3d" option is true */
transform: translateZ([value]);
}
/* when the value is an array with two values: */
.translate-[key] {
transform: translate([value-1], [value-2]);
}
/* when the value is an array with three values: */
.translate-[key] {
transform: translate3d([value-1], [value-2], [value-3]);
}
/* configurable with the "scale" theme object */
.scale-[key] {
transform: scale([value]);
}
.scale-x-[key] {
transform: scaleX([value]);
}
.scale-y-[key] {
transform: scaleY([value]);
}
.scale-z-[key] { /* only if the "3d" option is true */
transform: scaleZ([value]);
}
/* when the key starts with a minus sign: */
.-scale-[key] {
transform: scale([value]);
}
.-scale-x-[key] {
transform: scaleX([value]);
}
.-scale-y-[key] {
transform: scaleY([value]);
}
.-scale-z-[key] { /* only if the "3d" option is true */
transform: scaleZ([value]);
}
/* when the value is an array with two values: */
.scale-[key] {
transform: scale([value-1], [value-2]);
}
/* when the value is an array with three values: */
.scale-[key] {
transform: scale3d([value-1], [value-2], [value-3]);
}
/* configurable with the "rotate" theme object */
.rotate-[key] {
transform: rotate([value]);
}
.rotate-x-[key] { /* only if the "3d" option is true */
transform: rotateX([value]);
}
.rotate-y-[key] { /* only if the "3d" option is true */
transform: rotateY([value]);
}
/* when the key starts with a minus sign: */
.-rotate-[key] {
transform: rotate([value]);
}
.-rotate-x-[key] { /* only if the "3d" option is true */
transform: rotateX([value]);
}
.-rotate-y-[key] { /* only if the "3d" option is true */
transform: rotateY([value]);
}
/* when the value is an array: */
.rotate-[key] {
transform: rotate3d([value-1], [value-2], [value-3], [value-4]);
}
/* configurable with the "skew" theme object */
.skew-x-[key] {
transform: skewX([value]);
}
.skew-y-[key] {
transform: skewY([value]);
}
/* when the key starts with a minus sign: */
.-skew-x-[key] {
transform: skewX([value]);
}
.-skew-y-[key] {
transform: skewY([value]);
}
/* configurable with the "perspective" theme object (only if the "3d" option is true) */
.perspective-[key] {
perspective: [value]
}
/* configurable with the "perspectiveOrigin" theme object (only if the "3d" option is true) */
.perspective-[key] {
perspective-origin: [value]
}
/* generated when the "3d" option is set to true */
.transform-flat {
transform-style: flat;
}
.transform-preserve-3d {
transform-style: preserve-3d;
}
.backface-visible {
backface-visibility: visible;
}
.backface-hidden {
backface-visibility: hidden;
}
/* not configurable (except for variants) */
.transform-border {
transform-box: border-box;
}
.transform-fill {
transform-box: fill-box;
}
.transform-view {
transform-box: view-box;
}
Unable to get transform classes to show up in my compiled CSS file.
I've added the tailwindcss-transform package as a plugin in my tailwind.config.js file, and even though the postcss build passes without any issues, I can't seem to see the classes in my compiled, minified style.css. Is there any other pre-requisite I'm missing? facing this same issue in another Nuxt project I'm working on.
Add ability to generate custom transforms
By introducing a
customTransforms
(or justtransforms
?) option which would let you control the full value of thetransform
property. Maybe thenone
value could be part of it by default?Combining rotate and scale on hover does not seem to work
I have classes like these:
If I remove the
hover: rotate-90
, the scale works, if I leave it, it does not. But: Having no rotate class on hover makes the item spin back to its original rotation state.Is that intended behaviour or a bug?
Add class selector to transformStyle & backfaceVisibility utilities
The
transformStyle
andbackfaceVisibility
utility classes are missing the class selector.
, was receiving this error:Bump handlebars from 4.1.2 to 4.5.3
Bumps handlebars from 4.1.2 to 4.5.3.
Changelog
Sourced from handlebars's changelog.
Commits
c819c8b
v4.5.3827c9d0
Update release notesf7f05d7
fix: add "no-prototype-builtins" eslint-rule and fix all occurences1988878
fix: add more properties required to be enumerable886ba86
test/chore: add chai/expect and sinon to "runtime"-environment0817dad
test: add sinon as global variable to eslint in the specs93516a0
test: add sinon.js for spies, deprecate current assertions93e284e
chore: add chai and dirty-chai for better test assertionsc02b05f
fix: use !== 0 instead of != 08de121d
v4.5.2Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot ignore this [patch|minor|major] version
will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
No Copyright Licence
Hi,
I found your project it completely solves my problems but to use it on the project that I'm working on I need to have a copyright licence, do you think it could be possible to add it to the project?
https://help.github.com/en/articles/licensing-a-repository
Thanks in advance, cheers
Bump lodash from 4.17.11 to 4.17.13
Bumps lodash from 4.17.11 to 4.17.13.
Commits
e371828
Bump to v4.17.13.357e899
Rebuild lodash and docs.fd9a062
Bump to v4.17.12.e77d681
Rebuild lodash and docs.629d186
Update OpenJS references.2406eac
Fix minified build.17a34bc
Fix test bootstrap for core build.53838a3
Fix tests in older browsers.29e2584
Fix style:test lint nits.8f4d3eb
Update deps.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot ignore this [patch|minor|major] version
will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageAdd `transform-box` utilties
Planning on deprecating
tailwindcss-transform
due to being under-developed and having 99% overlap withtailwindcss-transforms
. Since yours already supports configuring all properties I don't think it makes sense to maintain both side by side.I'd like to know if you'd be open to adding support for
transformBox
.Here's the classes I was generating on mine:
Add ability to generate 3D transforms
When a new
3d
option istrue
, the following utilities should be generated:translate-z-[name]
-translate-z-[name]
scale-z-[name]
rotate-x-[name]
rotate-y-[name]
-rotate-x-[name]
-rotate-y-[name]
perspective-[name]
(need a newperspective
option)perspective-origin-[name]
(need a newperspective-origin
option? or just include Tailwind's defaultbackgroundPosition
options?)transform-flat
transform-preserve-3d
backface-visible
backface-hidden
Also, turns out
rotateZ()
is the same asrotate()
so no need forrotate-z-[name]
utilities.Added option to 3d transforms
Heyo...
I've added the ability to use 3d transforms, example:
There is a big ole conflict with the formatting, I'm using vscode with prettier and format on save, so it kinda did it's thing!
I've updated the test and readme.
It would be grand if this could get merged.
cheers
Ability to generate multi-axis transforms
The
translate
,scale
, androtate
theme objects should accept arrays to generate multi-axis transform utilities.translate
orscale
value is an array with two values, it should generate a singletranslate-[key]
/scale-[key]
utility withtransform: translate([value-1], [value-2])
/transform: scale([value-1], [value-2])
.translate
orscale
value is an array with three values, it should generate a singletranslate-[key]
/scale-[key]
utility withtransform: translate3d([value-1], [value-2], [value-3])
/transform: scale3d([value-1], [value-2], [value-3])
.rotate
value is an array, it should generate a singlerotate-[key]
utility withtransform: rotate3d([value-1], [value-2], [value-3], [value-4])
.Bump acorn from 5.7.3 to 5.7.4
Bumps acorn from 5.7.3 to 5.7.4.
Commits
6370e90
Mark version 5.7.4fbc15b1
More rigorously check surrogate pairs in regexp validatorDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.