2022-02-20 05:27:41 +00:00
|
|
|
{ runCommand, tailwindcss, nodePackages }:
|
2022-01-22 01:22:15 +00:00
|
|
|
|
|
|
|
let
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
inherit (tailwindcss) packageName version;
|
2022-02-20 05:27:41 +00:00
|
|
|
|
|
|
|
tailwindcssInput = builtins.toFile "input.css" ''
|
|
|
|
@tailwind base;
|
|
|
|
@tailwind components;
|
|
|
|
@tailwind utilities;
|
|
|
|
'';
|
|
|
|
|
|
|
|
tailwindcssWithPlugins = tailwindcss.overrideAttrs (oldAttrs: {
|
|
|
|
plugins = [
|
|
|
|
nodePackages."@tailwindcss/typography"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
|
|
|
tailwindcssWithPluginsConfig = builtins.toFile "tailwind.config.js" ''
|
|
|
|
module.exports = {
|
|
|
|
content: ["./with-typography.input"],
|
|
|
|
plugins: [
|
|
|
|
require('@tailwindcss/typography'),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
runCommand "${packageName}-tests" { meta.timeout = 60; }
|
|
|
|
''
|
2022-02-20 05:27:41 +00:00
|
|
|
mkdir $out
|
|
|
|
|
2022-01-22 01:22:15 +00:00
|
|
|
# Ensure CLI runs
|
|
|
|
${tailwindcss}/bin/tailwind --help > /dev/null
|
|
|
|
${tailwindcss}/bin/tailwindcss --help > /dev/null
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
# Ensure CLI with plugins runs
|
|
|
|
echo '"ml-4 prose"' > ./with-typography.input
|
|
|
|
${tailwindcssWithPlugins}/bin/tailwind \
|
|
|
|
--config ${tailwindcssWithPluginsConfig} \
|
|
|
|
--input ${tailwindcssInput} \
|
|
|
|
--output $out/with-typography.css
|
|
|
|
|
|
|
|
grep -q ml-4 $out/with-typography.css
|
|
|
|
grep -q prose $out/with-typography.css
|
2022-01-22 01:22:15 +00:00
|
|
|
''
|