Skip to content

Instantly share code, notes, and snippets.

@davexunit
Created March 18, 2021 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davexunit/a4d8011b09e0b9c7afc95bc17f14abbb to your computer and use it in GitHub Desktop.
Save davexunit/a4d8011b09e0b9c7afc95bc17f14abbb to your computer and use it in GitHub Desktop.
(make-page "foo.css"
;; Add other necessary context here.
'((input-file . "foo.scss"))
(lambda (args port)
;; I don't use a sass compiler so I'm just making the
;; options up. Hopefully sass can output to STDOUT.
(let* ((pipe (open-pipe* OPEN_READ "sass" (assq-ref args 'input-file))))
;; There's ways of doing i/o redirection so you don't
;; have to read the entire pipe output into Scheme, but
;; I don't remember how off the top of my head and this
;; is just a quick example rather than an efficient
;; one.
(display (get-string-all pipe) port)
(unless (zero? (status:exit-val (close-pipe pipe)))
(error "uh oh")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment