{"id":24811645,"url":"https://github.com/nha/boot-uglify","last_synced_at":"2025-07-06T10:36:06.105Z","repository":{"id":62433849,"uuid":"48296084","full_name":"nha/boot-uglify","owner":"nha","description":"minification/compression for Clojure","archived":false,"fork":false,"pushed_at":"2019-11-08T00:56:39.000Z","size":530,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T06:49:53.029Z","etag":null,"topics":["boot-uglify","clojure","clojurescript","compression","minifies","uglifyjs"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-19T20:23:37.000Z","updated_at":"2024-04-01T08:27:47.000Z","dependencies_parsed_at":"2022-11-01T21:01:53.059Z","dependency_job_id":null,"html_url":"https://github.com/nha/boot-uglify","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nha%2Fboot-uglify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nha%2Fboot-uglify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nha%2Fboot-uglify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nha%2Fboot-uglify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nha","download_url":"https://codeload.github.com/nha/boot-uglify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236353168,"owners_count":19135501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boot-uglify","clojure","clojurescript","compression","minifies","uglifyjs"],"created_at":"2025-01-30T13:15:39.828Z","updated_at":"2025-01-30T13:15:41.172Z","avatar_url":"https://github.com/nha.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Boot-uglify\n\n[![Clojars Project](https://img.shields.io/clojars/v/nha/boot-uglify.svg)](https://clojars.org/nha/boot-uglify)\n[![CircleCI](https://circleci.com/gh/nha/boot-uglify.svg?style=shield)](https://circleci.com/gh/nha/boot-uglify.svg?style=shield)\n\nA [Clojure](https://clojure.org/) library to minify JavaScript code.\n\nUse it as an extra optimisation step in your release process to make the JavaScrip file(s) smaller.\nUse the Google Closure Compiler normally but when releasing files in `:advanced` mode, use this library to further compress the files. There can be [20%](https://blog.jeaye.com/2016/02/16/clojurescript/) gain on the final file served.\n\n\n# Installation\n\n[![Clojars Project](http://clojars.org/nha/boot-uglify/latest-version.svg)](http://clojars.org/nha/boot-uglify)\n\nPlease note that one of the dependencies is not on maven. So please add the follwowing to you leiningen project.clj:\n\n```clojure\n:repositories [[\"bintray.jbrotli\" \"http://dl.bintray.com/nitram509/jbrotli\"]]\n```\n\nIf using `boot`, the equivalent is:\n\n```clojure\n(set-env!\n :repositories #(conj % '[\"bintray\" {:url \"http://dl.bintray.com/nitram509/jbrotli\"}]))\n```\n\n\n# Usage\n\nThe minifier provides two functions called `minify-css` and `minify-js`, both functions accept a source path followed by the output target and an optional parameter map. The source can be a filename, a directory, or a sequence of directories and or filenames.\n\n\n```clojure\n(ns my.ns\n  (:require [nha.boot-uglify.core :refer [minify-js]]))\n\n\n;; (minify-js in out) ;; operates on files or directories\n\n;; on a single input file\n(minify-js \"arrays.js\" \"arrays.min.js\") ;;=\u003e {:errors '(), :warnings '(), :sources '(\"arrays.js\"), :target \"arrays.min.js\", :original-size 153, :compressed-size 47, :original-gzipped-size 109, :gzipped-size 55}\n\n;; several input files\n(minify-js [\"file1.js\" \"file2.js\"] \"twofiles.min.js\") ;; {:errors '(), :warnings '(), :sources '(\"arrays.js\" \"blocks.js\"), :target \"twofiles.min.js\", :original-size 336, :compressed-size 121, :original-gzipped-size 197, :gzipped-size 114}\n\n;; a directory\n(minify-js \"js-files-dir/\" \"all.min.js\")\n\n\n```\n\n## Usage with boot\n\n\nRelevant parts to add to the `build.boot` :\n\n\n```clojure\n(set-env! :dependencies '[;; ...\n                          [nha/boot-uglify \"2.8.29\"]\n                          ])\n\n(require\n ;;...\n '[nha.boot-uglify  :refer [uglify]]\n )\n\n;; sample task\n(deftask package\n  \"Build the package\"\n  []\n  (comp\n   ;;(watch)\n   (cljs :optimizations :advanced)\n   (uglify) ;; put after the cljs task\n   ;;(aot)\n   ;;(pom)\n   ;;(uber)\n   ;;(jar)\n   ))\n\n```\n\n\n## Options (WIP)\n\nThe default options are:\n\n```clojure\n(def default-options {:sequences     true,  ; join consecutive statemets with the “comma operator”\n                      :properties    true,  ; optimize property access: a[\"foo\"] → a.foo\n                      :dead_code     true,  ; discard unreachable code\n                      :drop_debugger true,  ; discard “debugger” statements\n                      :unsafe        false, ; some unsafe optimizations\n                      :conditionals  true,  ; optimize if-s and conditional expressions\n                      :comparisons   true,  ; optimize comparisons\n                      :evaluate      true,  ; evaluate constant expressions\n                      :booleans      true,  ; optimize boolean expressions\n                      :loops         true,  ; optimize loops\n                      :unused        true,  ; drop unused variables/functions\n                      :hoist_funs    true,  ; hoist function declarations\n                      :hoist_vars    false, ; hoist variable declarations\n                      :if_return     true,  ; optimize if-s followed by return/continue\n                      :join_vars     true,  ; join var declarations\n                      :cascade       true,  ; try to cascade `right` into `left` in sequences\n                      :side_effects  true,  ; drop side-effect-free statements\n                      :warnings      true,  ; warn about potentially dangerous optimizations/code\n                      :global_defs   {},    ; global definitions\n                      :mangle        false  ; mangle names\n                      })\n```\n\n# Thanks\n\nThe following libraries were a source of inspiration or code (or both):\n- [ClojureScript](https://github.com/clojure/clojurescript)\n- [assets-minifier](https://github.com/yogthos/asset-minifier)\n- [boot-cljsjs](https://github.com/adzerk-oss/boot-cljs)\n- [UglifyJS-java](https://github.com/yuanyan/UglifyJS-java)\n\nRemaining bugs are mine though.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnha%2Fboot-uglify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnha%2Fboot-uglify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnha%2Fboot-uglify/lists"}