lessc: add wrapper for plugins
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
parent
86f67380e9
commit
ffb0c35cb9
@ -35,6 +35,8 @@ buildNpmPackage rec {
|
|||||||
passthru = {
|
passthru = {
|
||||||
updateScript = nix-update-script { };
|
updateScript = nix-update-script { };
|
||||||
plugins = callPackage ./plugins { };
|
plugins = callPackage ./plugins { };
|
||||||
|
wrapper = callPackage ./wrapper { };
|
||||||
|
withPlugins = fn: lessc.wrapper.override { plugins = fn lessc.plugins; };
|
||||||
tests = {
|
tests = {
|
||||||
version = testers.testVersion { package = lessc; };
|
version = testers.testVersion { package = lessc; };
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
testers,
|
testers,
|
||||||
runCommand,
|
runCommand,
|
||||||
writeText,
|
writeText,
|
||||||
symlinkJoin,
|
|
||||||
lessc,
|
lessc,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -35,15 +34,7 @@ buildNpmPackage {
|
|||||||
actual =
|
actual =
|
||||||
runCommand "actual"
|
runCommand "actual"
|
||||||
{
|
{
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [ (lessc.withPlugins (p: [ p.clean-css ])) ];
|
||||||
(symlinkJoin {
|
|
||||||
name = "less-css-with-plugins";
|
|
||||||
paths = [
|
|
||||||
lessc
|
|
||||||
lessc.plugins.clean-css
|
|
||||||
];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
base = writeText "base" ''
|
base = writeText "base" ''
|
||||||
@color: red;
|
@color: red;
|
||||||
body {
|
body {
|
||||||
@ -52,10 +43,6 @@ buildNpmPackage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
NODE_PATH = lib.concatMapStringsSep ":" (pkg: "${pkg}/lib/node_modules") [
|
|
||||||
lessc
|
|
||||||
lessc.plugins.clean-css
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
lessc $base --clean-css="--s1 --advanced" > $out
|
lessc $base --clean-css="--s1 --advanced" > $out
|
||||||
|
|||||||
@ -9,7 +9,7 @@ while ! test -f flake.nix; do cd .. ; done
|
|||||||
NIXPKGS_DIR="$PWD"
|
NIXPKGS_DIR="$PWD"
|
||||||
|
|
||||||
latest_commit="$(
|
latest_commit="$(
|
||||||
curl https://api.github.com/repos/less/less-plugin-clean-css/branches/master \
|
curl -L -s ${GITHUB_TOKEN:+-u ":${GITHUB_TOKEN}"} https://api.github.com/repos/less/less-plugin-clean-css/branches/master \
|
||||||
| jq -r .commit.sha
|
| jq -r .commit.sha
|
||||||
)"
|
)"
|
||||||
|
|
||||||
|
|||||||
27
pkgs/by-name/le/lessc/wrapper/default.nix
Normal file
27
pkgs/by-name/le/lessc/wrapper/default.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
makeWrapper,
|
||||||
|
lessc,
|
||||||
|
plugins ? [ ],
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "lessc-with-plugins";
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
|
||||||
|
makeWrapper "${lib.getExe lessc}" "$out/bin/lessc" \
|
||||||
|
--prefix NODE_PATH : "${lib.makeSearchPath "/lib/node_modules" plugins}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
doUnpack = false;
|
||||||
|
|
||||||
|
inherit (lessc)
|
||||||
|
version
|
||||||
|
src
|
||||||
|
passthru
|
||||||
|
meta
|
||||||
|
;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user