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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27449 in the body.
You can then email your comments to 27449 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#27449; Package guix-patches. (Thu, 22 Jun 2017 15:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 22 Jun 2017 15:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
To: <guix-patches <at> gnu.org>
Cc: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
Subject: [PATCH] gnu: Add js-respond.
Date: Thu, 22 Jun 2017 17:19:39 +0200
* gnu/packages/javascript.scm (js-respond): New variable.
---
 gnu/packages/javascript.scm | 51 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 6746ad1d2..43bc0bbf6 100644
--- a/gnu/packages/javascript.scm
+++ b/gnu/packages/javascript.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Arun Isaac <arunisaac <at> systemreboot.net>
+;;; Copyright © 2017 Ricardo Wurmus <rekado <at> elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -83,3 +84,53 @@ and AsciiMath notation that works in all modern browsers.  It requires no
 plugins or software to be installed on the browser.  So the page author can
 write web documents that include mathematics and be confident that readers will
 be able to view it naturally and easily.")))
+
+(define-public js-respond
+  (package
+    (name "js-respond")
+    (version "1.4.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/scottjehl/Respond/"
+                                  "archive/" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0ds1ya2a185jp93mdn07159c2x8zczwi960ykrawpp62bwk2n93d"))))
+    (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)))
+    (home-page "https://github.com/scottjehl/Respond")
+    (native-inputs
+     `(("uglify-js" ,uglify-js)
+       ("source" ,source)
+       ("gzip" ,gzip)
+       ("tar" ,tar)))
+    (synopsis "Polyfill for min/max-width CSS3 Media Queries")
+    (description "The goal of this script is to provide a fast and lightweight
+script to enable responsive web designs in browsers that don't support CSS3
+Media Queries.")
+    (license license:expat)))
-- 
2.13.0





Information forwarded to guix-patches <at> gnu.org:
bug#27449; Package guix-patches. (Thu, 22 Jun 2017 16:14:01 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>
Cc: 27449 <at> debbugs.gnu.org
Subject: Re: [bug#27449] [PATCH] gnu: Add js-respond.
Date: Thu, 22 Jun 2017 18:13:16 +0200
Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de> skribis:

> * gnu/packages/javascript.scm (js-respond): New variable.

LGTM.

> +    (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’?

Thanks,
Ludo’.




Reply sent to Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>:
You have taken responsibility. (Fri, 23 Jun 2017 06:23:02 GMT) Full text and rfc822 format available.

Notification sent to Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de>:
bug acknowledged by developer. (Fri, 23 Jun 2017 06:23:02 GMT) Full text and rfc822 format available.

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




Information forwarded to guix-patches <at> gnu.org:
bug#27449; Package guix-patches. (Fri, 23 Jun 2017 09:35:01 GMT) Full text and rfc822 format available.

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

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

> 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.

If we can’t come up with a full build system, perhaps a (guix build
javascript) module could at least provide a ‘minify’ procedure that
invokes uglify, or something like that?

Ludo’.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 21 Jul 2017 11:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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