--- title: Migrating --- {% include_relative includes/_header.html %}
npm install @area17/a17-tailwind-plugins@latest
screens, mainColWidths, innerGutters, outerGutters and columnCount are defined at all breakpointsPreviously you could define just the breakpoints where the gutters changed:
const { Setup } = require('@area17/a17-tailwind-plugins');
module.exports = {
...
plugins: [Setup],
theme: {
screens: {
xs: "0",
sm: "544px",
md: "650px",
lg: "990px",
xl: "1300px",
xxl: "1520px"
},
mainColWidths: {
xs: "auto",
xxl: "1440px"
},
innerGutters: {
xs: "10px",
xxl: "40px"
},
outerGutters: {
xs: "20px",
sm: "30px",
xxl: "0px"
},
columnCount: {
xs: "4",
sm: "4",
md: "8",
lg: "12",
xl: "12",
xxl: "12"
},
}
...
};
This was unintentional and no longer works, so you'll need:
const { Setup } = require('@area17/a17-tailwind-plugins');
module.exports = {
...
plugins: [Setup],
theme: {
screens: {
xs: "0",
sm: "544px",
md: "650px",
lg: "990px",
xl: "1300px",
xxl: "1520px"
},
mainColWidths: {
xs: "auto",
sm: "auto",
md: "auto",
lg: "auto",
xl: "auto",
xxl: "1440px"
},
innerGutters: {
xs: "10px",
sm: "15px",
md: "20px",
lg: "30px",
xl: "40px",
xxl: "40px"
},
outerGutters: {
xs: "20px",
sm: "30px",
md: "40px",
lg: "40px",
xl: "40px",
xxl: "0px"
},
columnCount: {
xs: "4",
sm: "4",
md: "8",
lg: "12",
xl: "12",
xxl: "12"
},
}
...
};
See Layout/Breaking changes in v5.0.0
(\w*)-(\d\/\d|\d*)-cols(-no-gutter|-vw)?$1-cols$3-$2And for any fraction class usage:
(\w*)-(\d\/\d)-cols$1-cols-$2In your frontend.config.json you may have have had:
"font-family": "var(--sans)",
Font classes now have a prepended font-. So, you'll need to update to:
"font-family": "var(--font-sans)",
You'll need to move any styles specified in your config to inside your CSS if you used these plugins.
Tailwind provide an upgrade guide, you may need to do a mix of automatic and manual updates. Check those changes from v3 class name renames and removals.
tokens from spacing in the config JSONYou no longer require the Spacing tokens plugin or setup:
"tokens": {
"scaler": 4,
"arbitraries": {
"400": "400px",
"600": "600px"
}
},
Instead you add:
@theme {
--spacing: 1px;
}
{% include_relative tailwind.config.js %}
@config "./tailwind.config.js";
@import "tailwindcss";
@theme {
--container-*: initial;
--breakpoint-*: initial;
--color-*: initial;
--font-*: initial;
--text-*: initial;
--tracking-*: initial;
--leading-*: initial;
--spacing: 1px;
}
@utility container {
max-width: 100%;
}
{% include_relative postcss.config.js %}
If you're using Vite, you'll want to swap to import tailwindcss from '@tailwindcss/vite' and not use post CSS to compile, so you'll end up with a vite.config.js something like:
import eslintPlugin from '@nabla/vite-plugin-eslint'
import tailwindcss from '@tailwindcss/vite'
import laravel from 'laravel-vite-plugin'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import dynamicImport from 'vite-plugin-dynamic-import'
import environmentPlugin from 'vite-plugin-environment'
import manifestSRI from 'vite-plugin-manifest-sri'
export default ({ mode }) => {
return defineConfig({
server: {
host: 'sitename.test'
},
plugins: [
tailwindcss(),
dynamicImport(),
eslintPlugin(),
environmentPlugin({
MODE: mode,
BEHAVIORS_PATH: resolve(
__dirname,
'resources/frontend/scripts/behaviors'
),
BEHAVIORS_EXTENSION: 'js'
}),
laravel({
input: [
resolve(__dirname, 'resources/frontend/styles/app.css'),
resolve(__dirname, 'resources/frontend/scripts/app.js')
],
refresh: true
}),
manifestSRI()
],
resolve: {
alias: {
'@': resolve(__dirname, 'resources/frontend'),
'@root': resolve(__dirname, './'),
'@vitrineUI': resolve(__dirname, 'vendor/area17/vitrine-ui'),
'@vitrineUIComponents': resolve(
__dirname,
'vendor/area17/vitrine-ui/resources/views/components/'
)
}
}
})
}
You may also want to update your stylelint.config.js:
{
"extends": ["stylelint-config-standard", "stylelint-config-clean-order"],
"rules": {
"custom-property-pattern": null,
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"config",
"custom-variant",
"source",
"theme",
"utility",
"variant"
]
}
],
"at-rule-no-deprecated": [
true,
{
"ignoreAtRules": ["apply"]
}
],
"import-notation": "string",
"function-no-unknown": [
true,
{
"ignoreFunctions": ["theme"]
}
],
"no-descending-specificity": null
},
"ignoreFiles": [
"node_modules/**/*",
"public/build/**/*"
]
}
And then you'll have fun migrating classes. For example:
left-[-99999px] with -left-99999flex-shrink-0 has been replaced by shrink-0Tailwind has a list of renamed utilities. and some removed utilities.
If you have any CSS in your project, you may want to update to use @utility and @layer components {}
For example:
.effect-hidden-fade {
@apply pointer-events-none invisible opacity-0;
will-change: opacity, visibility;
transition:
opacity 300ms cubic-bezier(0, 0, 0.58, 1) 50ms,
visibility 0s 351ms;
}
becomes:
@utility effect-hidden-fade {
@apply pointer-events-none invisible opacity-0;
will-change: opacity, visibility;
transition:
opacity 300ms cubic-bezier(0, 0, 0.58, 1) 50ms,
visibility 0s 351ms;
}
And:
.wysiwyg * {
@apply f-body;
}
.wysiwyg h2,
.wysiwyg h3,
.wysiwyg h4 {
@apply f-body font-bold text-balance mt-group-6;
}
.wysiwyg p {
@apply text-pretty;
}
becomes:
@layer components {
.wysiwyg * {
@apply f-body;
}
.wysiwyg h2,
.wysiwyg h3,
.wysiwyg h4 {
@apply f-body font-bold text-balance mt-group-6;
}
.wysiwyg p {
@apply text-pretty;
}
}