Skip to content

Commit

Permalink
feat!: remove support for stitches
Browse files Browse the repository at this point in the history
more information in #82

BREAKING CHANGE: will no longer work for projects using stitches
  • Loading branch information
joschka committed Nov 8, 2023
1 parent ff46340 commit ac87c45
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 113 deletions.
88 changes: 0 additions & 88 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,83 +76,6 @@ StyleDictionary.registerFormat({
},
});

StyleDictionary.registerFormat({
name: "stitches",
formatter: ({ dictionary, file }: { dictionary: Dictionary; file: File }) => {
return format(
`${fileHeader({ file })}export default ${JSON.stringify(
dictionary.allTokens.reduce(
(acc, token) => {
invariant(token.attributes, "Token attributes are undefined.");
const { category, type, item } = token.attributes;
// console.log(category, type, item, token);
if (token.path[0] === "color" && token.path[1] === "base") {
if (token.path.at(-1)?.match(/\d{2,3}/)) {
return merge(acc, {
theme: {
colors: token.path.slice(2, -2).reduceRight(
(acc, k) => {
return { [k]: acc };
},
{
[`${token.path.at(-2)}${token.path.at(-1)}`]:
token.value,
}
),
},
});
}
return merge(acc, {
theme: {
colors: token.path.slice(2).reduceRight((acc, k) => {
return { [k]: acc };
}, token.value),
},
});
}
if (category === "size" && type === "spacing") {
return merge(acc, {
theme: {
space: {
[item as string]: token.value,
},
},
});
}
if (token.path[0] === "font" && token.path[1] === "family") {
return merge(acc, {
theme: {
fontFamily: {
[token.name]: token.value,
},
},
});
}
return acc;
},
{
theme: {
colors: {
inherit: "inherit",
current: "currentColor",
transparent: "transparent",
},
fontFamily: {},
},
}
),
null,
2
)};`,
{ parser: "babel" }
);
},
});

const getStyleDictionaryConfig = (brand: string, platform: string) => {
return {
source: [
Expand Down Expand Up @@ -184,17 +107,6 @@ const getStyleDictionaryConfig = (brand: string, platform: string) => {
},
],
},
stitches: {
buildPath:
brand === "default" ? "dist/stitches/" : `dist/stitches/${brand}/`,
transforms: ["attribute/cti", "name/cti/camel", "size/rem"],
files: [
{
destination: "index.js",
format: "stitches",
},
],
},
},
};
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"clean": "rimraf dist",
"build": "ts-node build.ts && npm run ts-types",
"ts-types": "tsc --emitDeclarationOnly --esModuleInterop --module nodenext --moduleResolution nodenext --target es2015 -d --allowJs ./dist/stitches/index.js ./dist/tailwind/index.js",
"ts-types": "tsc --emitDeclarationOnly --esModuleInterop --module nodenext --moduleResolution nodenext --target es2015 -d --allowJs ./dist/tailwind/index.js",
"lint": "eslint . --ext .ts",
"postversion": "cp package.json LICENSE README.md ./dist/",
"test": "jest test/*"
Expand Down
20 changes: 0 additions & 20 deletions website/docs/how-to/use-with-stitches.md

This file was deleted.

4 changes: 0 additions & 4 deletions website/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ Currently the following platforms are supported. Please get in touch if you need

- JavaScript/TypeScript
- [Tailwind CSS](https://tailwindcss.com/)
- [Stitches](https://stitches.dev/) (CSS-in-JS)

## How-to guides

- [Install](./how-to/install.md)
- [Use with Tailwind](./how-to/use-with-tailwind.md)
- [Use with JS/TS](./how-to/use-with-javascript.md)
- [Use with Stitches](./how-to/use-with-stitches.md)

## Reference

Expand All @@ -26,5 +24,3 @@ Currently the following platforms are supported. Please get in touch if you need

- [Spacing](./explanation/spacing.md)
- [Colors](./explanation/colors.md)


0 comments on commit ac87c45

Please sign in to comment.