Skip to content

Commit

Permalink
release 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Aug 19, 2022
1 parent cbe2944 commit 4b2449c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "stailwc"
version = "0.3.0"
version = "0.3.1"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stailwc",
"version": "0.3.0",
"version": "0.3.1",
"description": "An experimental transpiler to bring tailwind macros to SWC rocket",
"author": "[email protected]",
"license": "ISC",
Expand Down
33 changes: 32 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,46 @@ performing considerably better than babel-based alternatives.
> yarn add stailwc
```

Currently the setup process is a little bit convoluted, but it
will be cleaned up in the future, once we determine the best
way to package this. Place the following in your next.config.js:

`next.config.js`

```js
const initStailwc = () => {
const resolveConfig = require("tailwindcss/resolveConfig");
const defaultConfig = require("tailwindcss/defaultConfig");
const override = require("./tailwind.config");

const config = resolveConfig(override, defaultConfig);

config.theme.colors = Object.entries(config.theme.colors)
.flatMap(([k, v]) => {
if (typeof v === "object") {
const items = Object.entries(v).map(([k2, v2]) => [k + "-" + k2, v2]);
return items;
} else {
return [[k, v]];
}
})
.reduce(
(acc, [k, v]) => ({
...acc,
[k]: v,
}),
{}
);

return ["stailwc", { config }];
};

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
experimental: {
swcPlugins: [["stailwc", {}]],
swcPlugins: [initStailwc()],
},
compiler: {
emotion: true,
Expand Down

0 comments on commit 4b2449c

Please sign in to comment.