Skip to content

Commit

Permalink
fix: make disable default style env variable work for client side bun…
Browse files Browse the repository at this point in the history
…dler and nextjs (#787)

close #713
  • Loading branch information
Jokcy committed Mar 2, 2023
1 parent cfa4193 commit 2a48214
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions sandpack-react/src/styles/index.ts
Expand Up @@ -12,11 +12,10 @@ import { createStitchesMock } from "./stitches-mock";
export const THEME_PREFIX = "sp";

const getNodeProcess = (): false | string | undefined => {
if (typeof process !== "undefined") {
return process.env.SANDPACK_BARE_COMPONENTS;
}

return false;
return (
process.env.SANDPACK_BARE_COMPONENTS ||
process.env.NEXT_PUBLIC_SANDPACK_BARE_COMPONENTS
);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion website/docs/src/pages/getting-started/layout.mdx
Expand Up @@ -34,7 +34,7 @@ This pattern is compatible with most modern styling systems, including Tailwind,

`@codesanbdox/sandpack-react` relies on [@stitches/core](https://github.com/stitchesjs/stitches) to style its component, which is almost zero-runtime CSS-in-JS framework. However, if you want to get rid of any runtime script or create your own style on top of Sandpack components, we provide a way to return bare components, which will eliminate all Sandpack CSS style.

To do it, you need to pass `SANDPACK_BARE_COMPONENTS` environment variable as `true`, which will remove the Stitches dependency, its execution and return only the HTML of the components.
To do it, you need to pass `SANDPACK_BARE_COMPONENTS` environment variable (`NEXT_PUBLIC_SANDPACK_BARE_COMPONENTS` for Nextjs) as `true`, which will remove the Stitches dependency, its execution and return only the HTML of the components.

## Themes

Expand Down

1 comment on commit 2a48214

@vercel
Copy link

@vercel vercel bot commented on 2a48214 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sandpack-docs – ./website/docs

sandpack-docs-codesandbox1.vercel.app
sandpack-docs-git-main-codesandbox1.vercel.app
sandpack.vercel.app

Please sign in to comment.