Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it would be cool if it could officially support react-strict-dom #50

Closed
advancedtw opened this issue Mar 20, 2024 · 2 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@advancedtw
Copy link

according to the limited instruction found here we are supposed to use { from: 'react-strict-dom', as: 'css'} along the default stylex import.

the ts type is defined like that not just a string as we have it now.

 importSources: ReadonlyArray<
        string | Readonly<{ from: string; as: string }>
 >;

vite config should probably look like this

export default defineConfig({
        plugins: [
                react(),
                styleX({
                        libraries: ["react-strict-dom"],
                        stylexImports: [
                                "@stylexjs/stylex",
                                { from: "react-strict-dom", as: "css" },
                        ],
                }),
        ],
        resolve: {
                alias: {
                        "@": resolve(__dirname, "src"),
                },
        },
});

example component

import { css, html as h } from "react-strict-dom";

const styles = css.create({
        root: {
                backgroundColor: "white",
                borderRadius: 8,
                padding: 16,
                boxShadow: "0 0 16px rgba(0, 0, 0, 0.1)",
                color: "pink",
        },
        override: (value) => ({
                color: value,
        }),
});

const Simple = () => {
        return <h.div style={[styles.root, styles.override("green")]}>Simple</h.div>;
};
export default Simple;
@HorusGoul
Copy link
Owner

Working on it @ #51

@HorusGoul HorusGoul self-assigned this Mar 20, 2024
@HorusGoul HorusGoul added the enhancement New feature or request label Mar 20, 2024
@HorusGoul HorusGoul linked a pull request Mar 20, 2024 that will close this issue
@HorusGoul HorusGoul removed a link to a pull request Mar 21, 2024
@HorusGoul
Copy link
Owner

Solved in 0.7.0, check the release notes! https://github.com/HorusGoul/vite-plugin-stylex/releases/tag/vite-plugin-stylex%400.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants