1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5 testers,
6 runCommand,
7 writeText,
8 lessc,
9}:
10
11buildNpmPackage {
12 pname = "less-plugin-clean-css";
13 version = "1.6.0";
14
15 src = fetchFromGitHub {
16 owner = "less";
17 repo = "less-plugin-clean-css";
18 rev = "b2c3886b7af67ab45a5568e7758bbc2d5b82b112";
19 hash = "sha256-dYYcaCLTwAI2T7cWCfiK866Azrw4fnzTE/mkUA6HUFo=";
20 };
21
22 npmDepsHash = "sha256-uAYXFxOoUo8tLrYqNeUFMRuaYp2GArGMLaaes1QhLp4=";
23
24 dontNpmBuild = true;
25
26 passthru = {
27 updateScript = ./update.sh;
28 tests = {
29 simple = testers.testEqualContents {
30 assertion = "lessc compiles a basic less file";
31 expected = writeText "expected" ''
32 body h1{color:red}
33 '';
34 actual =
35 runCommand "actual"
36 {
37 nativeBuildInputs = [ (lessc.withPlugins (p: [ p.clean-css ])) ];
38 base = writeText "base" ''
39 @color: red;
40 body {
41 h1 {
42 color: @color;
43 }
44 }
45 '';
46 }
47 ''
48 lessc $base --clean-css="--s1 --advanced" > $out
49 printf "\n" >> $out
50 '';
51 };
52 };
53 };
54
55 meta = {
56 homepage = "https://github.com/less/less-plugin-clean-css";
57 description = "Post-process and compress CSS using clean-css";
58 license = lib.licenses.asl20;
59 maintainers = with lib.maintainers; [ lelgenio ];
60 };
61}