next-yak
Version:
next-yak is a CSS-in-JS solution tailored for Next.js that seamlessly combines the expressive power of styled-components syntax with efficient build-time extraction of CSS using Next.js's built-in CSS configuration
1 lines • 1.19 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","names":[],"sources":["../../static/staticCssLiteral.tsx"],"sourcesContent":["/**\n * A stub that allows us to use the `css()` (css literal function) inside of *.yak files.\n *\n * This is mainly used for tooling like stylelint and typechecking inside css of *.yak files.\n * It works similar to String.raw but filters out undefined, null and false values to allow for conditionals.\n *\n * @example\n * ```tsx\n * // inside of example.yak.ts\n * import { mixin } from \"next-yak/static\";\n *\n * const styles = mixin.css`\n * .foo {\n * color: red;\n * ${data.isBar && css`\n * background: blue;\n * `}\n * }\n * `\n * ```\n */\nexport const css = (\n strings: TemplateStringsArray,\n ...values: Array<string | number | boolean | null | undefined | Function>\n): string =>\n String.raw(\n strings,\n ...values.map((value) =>\n // filter out everything but strings and numbers\n typeof value === \"number\" || typeof value === \"string\" ? value : \"\",\n ),\n ).trim();\n"],"mappings":"sOAqBA,MAAa,GACX,EACA,GAAG,IAEH,OAAO,IACL,EACA,GAAG,EAAO,IAAK,GAEb,OAAO,GAAU,UAAY,OAAO,GAAU,SAAW,EAAQ,GAClE,CACF,CAAC,MAAM"}