Skip to content

Commit

Permalink
Switch to Lightning CSS for minification
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkreeftmeijer committed May 3, 2024
1 parent fc9c385 commit 80dbf0c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 40 deletions.
27 changes: 4 additions & 23 deletions enough.css.org
Original file line number Diff line number Diff line change
Expand Up @@ -128,31 +128,12 @@ The /border-collapse/ property is used to combine the borders of adjacent cells.

** Minification

#+headers: :exports none
#+headers: :tangle postcss.config.js
#+begin_src js
module.exports = {
plugins: [
require('cssnano')({
preset: 'default',
}),
],
};
#+end_src

A minified version of enough.css is bundled in /enough.min.css/
It's generated by passing the source file through [[https://postcss.org][PostCSS]], which is configured to use [[https://cssnano.co][cssnano]].
Use NPM's install command to install the dependencies:

#+begin_src shell
npm install
#+end_src

Then, minify enough.css through npx:
A minified version of enough.css is bundled in /enough.min.css/.
It's generated by passing the source file through [[https://lightningcss.dev][Lightning CSS]]:

#+name: minify
#+begin_src shell :prologue npm install > /dev/null
npx postcss enough.css > enough.min.css
#+begin_src shell
lightningcss --minify enough.css > enough.min.css
#+end_src

** Git pre-commit hook
Expand Down
2 changes: 1 addition & 1 deletion enough.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
emacs-nox
lightningcss
];
};
});
Expand Down
7 changes: 0 additions & 7 deletions package.json

This file was deleted.

7 changes: 0 additions & 7 deletions postcss.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#/bin/sh
npx postcss enough.css > enough.min.css
lightningcss --minify enough.css > enough.min.css

0 comments on commit 80dbf0c

Please sign in to comment.