
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
sd-tailwindcss-transformer
Advanced tools
[](https://badgen.net/github/release/nado1001/sd-tailwindcss-transformer) [,
);
await styleDictionaryTailwind.hasInitialized;
await styleDictionaryTailwind.buildAllPlatforms();
Output:
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: "jit",
content: ["./src/**/*.{ts,tsx}"],
darkMode: "class",
theme: {
extend: {
colors: {
base: {
gray: "#111111",
red: "#FF0000",
...
}
},
fontSize: {
small: "0.75rem",
medium: "1rem",
...
}
},
}
}
Create an object for each theme, assuming that various customizations will be made in the configuration file.
Import and use the created files in tailwind.config.js
.
import StyleDictionary from 'style-dictionary';
import { makeSdTailwindConfig } from 'sd-tailwindcss-transformer';
const types = ['colors', 'fontSize'];
for (const type of types) {
let tailwindConfig = makeSdTailwindConfig({
type,
});
const styleDictionaryTailwind = new StyleDictionary(tailwindConfig);
await styleDictionaryTailwind.hasInitialized;
await styleDictionaryTailwind.buildAllPlatforms();
}
Output:
/// colors.tailwind.js
module.exports = {
base: {
gray: "#111111",
red: "#FF0000",
...
}
}
/// fontSize.tailwind.js
module.exports = {
small: "0.75rem",
medium: "1rem",
...
}
CSS custom variables can be used by setting isVariables to true
.
In this case, a CSS file must also be generated.
import StyleDictionary from 'style-dictionary';
import { makeSdTailwindConfig } from 'sd-tailwindcss-transformer';
const sdConfig = makeSdTailwindConfig({
type: 'all',
isVariables: true,
});
sdConfig.platforms['css'] = {
transformGroup: 'css',
buildPath: './styles/',
files: [
{
destination: 'tailwind.css',
format: 'css/variables',
options: {
outputReferences: true,
},
},
],
};
const styleDictionaryTailwind = new StyleDictionary(
makeSdTailwindConfig({ type: 'all' }),
);
await styleDictionaryTailwind.hasInitialized;
await styleDictionaryTailwind.buildAllPlatforms();
Output:
/* tailwind.css */
/**
* Do not edit directly
* Generated on ○○○○
*/
:root {
--font-size-medium: 1rem;
--font-size-small: 0.75rem;
--colors-base-red: #ff0000;
--colors-base-gray: #111111;
...;
}
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: "jit",
content: ["./src/**/*.{ts,tsx}"],
darkMode: "class",
theme: {
extend: {
colors: {
base: {
gray: "var(--colors-base-gray)",
red: "var(--colors-base-red)",
...
}
},
fontSize: {
small: "var(--font-size-small)",
medium: "var(--font-size-medium)",
...
}
},
}
}
Please see Example for details.
Optional except for type
.
Attribute | Description | Type |
---|---|---|
type | Set the name of each theme (colors, fontSize, etc.) for 'all' or tailwind. | 'all' or string |
formatType | Set the format of the Tailwind CSS configuration file. Default value: js | 'js' 'cjs' |
isVariables | Set when using CSS custom variables. Default value: false | boolean |
extend | Set to add transformed styles to the 'extend' key within the 'theme' key or not. Default value: true | boolean |
source | source attribute of style-dictionary.Default value: ['tokens/**/*.json'] | Array of strings |
transforms | platform.transforms attribute of style-dictionary.Default value: ['attribute/cti','name/cti/kebab'] | Array of strings |
buildPath | platform.buildPath attribute of style-dictionary.Default value: 'build/web/' | string |
prefix | platform.prefix attribute of style-dictionary.Valid when using css variables (isVariables: true) | string |
tailwind.content | Content attribute of Tailwind CSS. Set if necessary when 'all' is set in type. Default value: ['./src/**/*.{ts,tsx}'] | Array of strings |
tailwind.darkMode | Dark Mode attribute of Tailwind CSS. Set if necessary when 'all' is set in type. Default value: 'class' | 'media' 'class' |
tailwind.plugin | Tailwind CSS official plugins. Set if necessary when 'all' is set in type. | Array of 'typography' ['typography', options] 'forms' ['forms', options] 'aspect-ratio' 'line-clamp' 'container-queries' |
FAQs
[](https://badgen.net/github/release/nado1001/sd-tailwindcss-transformer) [![Test](https://github.com/nado1001/sd-tailwindcss-transformer/actions/workflows/test.yml/badge.svg
The npm package sd-tailwindcss-transformer receives a total of 26,138 weekly downloads. As such, sd-tailwindcss-transformer popularity was classified as popular.
We found that sd-tailwindcss-transformer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.