Complete the code to add a plugin in Tailwind CSS configuration.
module.exports = {
plugins: [[1]],
};In Tailwind CSS, plugins are added by requiring them without calling as a function unless specified. So require('@tailwindcss/forms') is correct.
Complete the code to define a custom plugin using Tailwind's plugin function.
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ plugin(function({ addUtilities }) { addUtilities({ '.text-shadow': { textShadow: '[1]' } }) }) ] };
The textShadow CSS property requires a string with offsets and blur radius plus color, like '2px 2px 5px #000000'.
Fix the error in the plugin code to correctly add a new utility class.
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ plugin(function({ addUtilities }) { addUtilities({ '.rotate-15': { transform: 'rotate([1]deg)' } }) }) ] };
The value inside the string should be a number without quotes because the whole value is already a string with 'deg' unit appended.
Fill both blanks to create a plugin that adds a new color utility and uses the theme function.
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ plugin(function({ addUtilities, [1] }) { const newColors = { '.text-brand': { color: [2]('colors.blue.500') } }; addUtilities(newColors); }) ] };
The theme function is used to access Tailwind's design tokens like colors inside plugins.
Fill all three blanks to create a plugin that adds a responsive utility with variants.
const plugin = require('tailwindcss/plugin'); module.exports = { plugins: [ plugin(function({ addUtilities, [1], e }) { const utilities = { [`.${e('skew-10')}`]: { transform: '[2](10deg)' } }; addUtilities(utilities, [3]); }) ] };
addUtilities is destructured to add utilities, skew is the CSS transform function, and the third argument specifies the variants like { variants: ['responsive'] }.