on decrease-android-validity help sign in
obelisk/lib/asset/README.md
29 lines 1.1 kB history raw
1## obelisk-asset
3The 'assets.nix' file contains nix expressions that are a mutually
4recursive set of attributes used to create static asset directories
5with hashable file encodings. This file should be incorporated within
6your project's 'default.nix' file. (See ./example/default.nix , line 2)
7```
8{assets ? import ./../assets.nix { inherit nixpkgs; }
9}:
10```
12The 'mkAssets' and 'mkAssetsWith' functions within 'assets.nix' only
13need to be passed an encoding('zopfliEncodings', 'gzipEncodings',
14'noEncodings') and a static directory of your choice as arguments.
16In this example, 'mkAssets' is used on a directory that has a .png
17file inside of it. (See ./example/default.nix, line 11)
18```
19myAssets = assets.mkAssets ./static;
20```
22Once you have successfully incorporated 'assets.nix' into your
23project's nix file(s), use nix-build to generate a symlink of
24your 'mkAssets' expression. The following command from
25example/run-example (line 3) will generate an immutable symlink
26that holds hashed static assets.
27```bash
28nix-build -o static.assets -A myAssets
29```