summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2017-06-22 17:19:39 +0200
committerRicardo Wurmus <rekado@elephly.net>2017-06-23 08:14:41 +0200
commitb37b48f8192678c1c0f72a62d3ad33c19da55d14 (patch)
treeddfb907ddd67f5bdbc6185b551f64768163fc628 /gnu
parent94820951d6b628dfe47778db76a38090761f3f35 (diff)
downloadguix-b37b48f8192678c1c0f72a62d3ad33c19da55d14.tar.gz
gnu: Add js-respond.
* gnu/packages/javascript.scm (js-respond): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/javascript.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm
index 6746ad1d22..43bc0bbf6d 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@systemreboot.net>
+;;; Copyright © 2017 Ricardo Wurmus <rekado@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)))