pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / development / node-packages / package-tests / tailwindcss.nix
blob1f986d8bb09664c8c34378876a3773be52933f1e
1 { runCommand, tailwindcss, nodePackages }:
3 let
5   inherit (tailwindcss) packageName version;
7   tailwindcssInput = builtins.toFile "input.css" ''
8     @tailwind base;
9     @tailwind components;
10     @tailwind utilities;
11   '';
13   tailwindcssWithPlugins = tailwindcss.overrideAttrs (oldAttrs: {
14     plugins = [
15       nodePackages."@tailwindcss/typography"
16     ];
17   });
19   tailwindcssWithPluginsConfig = builtins.toFile "tailwind.config.js" ''
20     module.exports = {
21       content: ["./with-typography.input"],
22       plugins: [
23         require('@tailwindcss/typography'),
24       ],
25     }
26   '';
30 runCommand "${packageName}-tests" { meta.timeout = 60; }
31   ''
32     mkdir $out
34     # Ensure CLI runs
35     ${tailwindcss}/bin/tailwind --help > /dev/null
36     ${tailwindcss}/bin/tailwindcss --help > /dev/null
38     # Ensure CLI with plugins runs
39     echo '"ml-4 prose"' > ./with-typography.input
40     ${tailwindcssWithPlugins}/bin/tailwind \
41       --config ${tailwindcssWithPluginsConfig} \
42       --input ${tailwindcssInput} \
43       --output $out/with-typography.css
45     grep -q ml-4 $out/with-typography.css
46     grep -q prose $out/with-typography.css
47   ''