refactor: flex basis plugin with options
This commit is contained in:
parent
317e1c10b7
commit
649fce7b67
|
@ -1,11 +1,21 @@
|
|||
let plugin = require("tailwindcss/plugin");
|
||||
|
||||
let flexBasisPlugin = plugin(function ({ addBase, addUtilities }) {
|
||||
let values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
||||
let flexBasisPlugin = plugin.withOptions(
|
||||
function (options) {
|
||||
return function ({ addUtilities }) {
|
||||
let values = options?.values ?? [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
||||
|
||||
values.forEach((value) => {
|
||||
addUtilities({ [`.flex-basis-${value}`]: { flexBasis: `${value}%` } });
|
||||
});
|
||||
});
|
||||
values.forEach((value) => {
|
||||
addUtilities({ [`.flex-basis-${value}`]: { flexBasis: `${value}%` } });
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
function (options) {
|
||||
return {
|
||||
values: options?.values ?? [],
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = flexBasisPlugin;
|
||||
|
|
Loading…
Reference in a new issue