GNU bug report logs - #27449
[PATCH] gnu: Add js-respond.

Previous Next

Package: guix-patches;

Reported by: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>

Date: Thu, 22 Jun 2017 15:21:02 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 27449-done <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 27449-done <at> debbugs.gnu.org
Subject: Re: [bug#27449] [PATCH] gnu: Add js-respond.
Date: Fri, 23 Jun 2017 08:20:58 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de> skribis:
>
>> * gnu/packages/javascript.scm (js-respond): New variable.
>
> LGTM.

Thanks.  Pushed to master with b37b48f81.

>> +    (build-system trivial-build-system)
>> +    (arguments
>> +     `(#:modules ((guix build utils))
>> +       #:builder
>> +       (begin
>> +         (use-modules (guix build utils)
>> +                      (ice-9 match)
>> +                      (ice-9 popen)
>> +                      (srfi srfi-26))
>> +         (set-path-environment-variable
>> +          "PATH" '("bin") (map (match-lambda
>> +                                 ((_ . input)
>> +                                  input))
>> +                               %build-inputs))
>> +         (let ((install-directory (string-append %output
>> +                                                 "/share/javascript/respond/")))
>> +           (system* "tar" "xvf"
>> +                    (assoc-ref %build-inputs "source")
>> +                    "--strip" "1")
>> +           (mkdir-p install-directory)
>> +           (let* ((file "src/respond.js")
>> +                  (installed (string-append install-directory "respond.min.js")))
>> +             (let ((minified (open-pipe* OPEN_READ "uglify-js" file)))
>> +               (call-with-output-file installed
>> +                 (cut dump-port minified <>)))))
>> +         #t)))
>
> Should we turn this into a ‘javascript-build-system’?

This is a simplified version of what js-mathjax does, so that seems like
a good template for minifying JavaScript files.  I’m just not sure how
to generalise this, because projects don’t always put all their
unminified .js files in a single directory and we can’t just minify all
.js files, because

  a) they might already be minified,
  b) they might require compilation / concatenation.

Maybe we should wait until we have some more experience with how other
JS projects handle this.  I’m going to package a few more JS things for
r-shiny; if a pattern should pop up I’m going to poor it into a build
system.

-- Ricardo




This bug report was last modified 7 years and 341 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.