Code Monkey home page Code Monkey logo

asset-minifier's Introduction

asset-minifier's People

Contributors

alehatsman avatar blak3mill3r avatar mavbozo avatar nkabrich avatar rangeoshun avatar rredpoppy avatar stephanos avatar yogthos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asset-minifier's Issues

setting language-in option

there is a minify task in boot-cljsjs that uses minify-js. Being able to set the closure compiler option for "language-in" to ECMASCRIPT5 will help us prevent "trailing comma" errors when minifying some cljsjs-packages that are auto-built.

I can create the PR; just let me know if you have thoughts on it. thanks

setting language-out option

I need to transpile a package from ES6 to ES5 in cljsjs/packages, which uses asset-minifier.core/minify-js to do minifications. Currently this is not possible as LANGUAGE_OUT arg cannot be set, and hence this error:

ES6 is only supported for transpilation to a lower ECMAScript version. Set --language_out to ES3, ES5, or ES5_STRICT.

Any ideas or thought, or shall I just create a PR? I'd gladly do that BTW.

Cheers!

No such file or directory

I'm using lein-asset-minifier and ran into a problem:

minifying assets...
java.io.FileNotFoundException: resources/public/js/libs.js (No such file or directory)
 at java.io.FileOutputStream.open (FileOutputStream.java:-2)
    java.io.FileOutputStream.<init> (FileOutputStream.java:221)
    clojure.java.io/fn (io.clj:230)
    clojure.java.io$fn__8641$G__8604__8648.invoke (io.clj:69)
    clojure.java.io/fn (io.clj:263)
    clojure.java.io$fn__8641$G__8604__8648.invoke (io.clj:69)
    clojure.java.io/fn (io.clj:166)
    clojure.java.io$fn__8654$G__8608__8661.invoke (io.clj:69)
    clojure.java.io$writer.doInvoke (io.clj:119)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    asset_minifier.core$minify_js.doInvoke (core.clj:112)
    clojure.lang.RestFn.invoke (RestFn.java:442)
    asset_minifier.core$minify$iter__1060__1064$fn__1065.invoke (core.clj:127)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:484)
    clojure.core$seq.invoke (core.clj:133)
    clojure.core.protocols$seq_reduce.invoke (protocols.clj:30)
    clojure.core.protocols/fn (protocols.clj:54)
    clojure.core.protocols$fn__6031$G__6026__6044.invoke (protocols.clj:13)
    clojure.core$reduce.invoke (core.clj:6289)
    clojure.core$into.invoke (core.clj:6341)
    asset_minifier.core$minify.doInvoke (core.clj:124)
    clojure.lang.RestFn.invoke (RestFn.java:423)
    leiningen.minify_assets$minify.invoke (minify_assets.clj:42)
    leiningen.minify_assets$minify_assets.doInvoke (minify_assets.clj:99)
    clojure.lang.RestFn.invoke (RestFn.java:423)
    clojure.lang.Var.invoke (Var.java:383)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$partial_task$fn__6071.doInvoke (main.clj:253)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$apply_task.invoke (main.clj:303)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:309)
    leiningen.do$do.doInvoke (do.clj:40)
    clojure.lang.RestFn.invoke (RestFn.java:516)
    clojure.lang.Var.invoke (Var.java:409)
    clojure.lang.AFn.applyToHelper (AFn.java:178)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$partial_task$fn__6071.doInvoke (main.clj:253)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$apply_task.invoke (main.clj:303)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:309)
    leiningen.core.main$_main$fn__6136.invoke (main.clj:377)
    leiningen.core.main$_main.doInvoke (main.clj:366)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:624)
    clojure.main$main_opt.invoke (main.clj:315)
    clojure.main$main.doInvoke (main.clj:420)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    clojure.lang.Var.invoke (Var.java:388)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

The js directory does not exist inside resources/public (because lein clean removed it). Could you automatically create the parent directories with (io/make-parents dest-file)?

Multiple targets option

There could be a way of create multiples targets with the same source file, so i will not have a big file with all js, and i only need to import in my html the file that i want. It will only minify the file, not group all files in one.

Something like this example:

:minify-assets [[:js {
    :source ["source/"] 
    :target "target/",
    :pattern "*.min.js"}]]

from:

source
├── login.js
└── home.js

to

target
├── login.min.js
└── home.min.js

What you think of it?

Add HTML minification

In addition to CSS and JS, HTML can also be minified to reduce the size of assets that need to be sent over the wire.

There is an existent library for the JVM that does that well: htmlcompressor. Example Clojure use of this can be found here.

Would you accept a PR for this? Any additional thoughts?

Directory structure being flattened

Right now if source is a directory with subdirectories, the subdirectory structure will not be preserved in target. Would it make sense to preserve any subdirectory structure in the target directory? The current behavior runs the risk of files in subdirectories overwriting identically-named files in a parent directory (in the target directory).

Otherwise, it would be nice to be able to disallow this recursive behavior, giving the user the chance to handle subdirectories with multiple calls to minify.

I am actually having this problem with the lein-asset-minifier project, but I'm guessing this is the appropriate place for the issue. If you you think either of these should be implemented but don't have the time to do it yourself, I'd be happy to help.

Charset exceptions

I am getting this exception when using minify-js:
java.lang.String cannot be cast to java.nio.charset.Charset

on a side note: why use such an old closure compiler?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.