Coder Social home page Coder Social logo

sbt-closure's Introduction

sbt-closure

Build Status

sbt-web plugin which integrates with Google’s Closure Compiler.

Plugin

Add the plugin to your project/plugins.sbt:

addSbtPlugin("net.ground5hark.sbt" % "sbt-closure" % "0.1.4")

Add the Sonatype releases resolver:

resolvers += Resolver.sonatypeRepo("releases")

Enable the sbt-web plugin for your project:

lazy val root = (project in file(".")).enablePlugins(SbtWeb)

Add the closure task to your asset pipeline in your build.sbt:

pipelineStages := Seq(closure)

Configuration options

Option Description
suffix Suffix to append to each file compiled by closure. Defaults to ".min.js"
flags List of command line flags to provide to the closure compiler. Must be in the format of --option-name=value or --option-flag
parentDir Parent directory name where closure compiled JS will go. Defaults to "closure-compiler"

An example of providing options is below:

Closure.suffix := ".min.js"

Closure.flags := Seq("--formatting=PRETTY_PRINT", "--accept_const_keyword")

This will produce assets with the specified Closure.suffix suffix value under the Closure.parentDir directory within the target folder. This will be target/web/public/main or target/web/stage. For a full list of closure compiler options, see the official documentation page. You can also specify includeFilter in closure or excludeFilter in closure to select files on a custom criteria.

License

This code is licensed under the MIT License.

sbt-closure's People

Contributors

john-bernardo1 avatar olegstepura avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

sbt-closure's Issues

--js-output-file not supported

It seems that in the plugin code you are stripping away the most useful feature of the entire compiler, for reasons unknown. How can an app be minified to a single file or a one file per module approach?

Both features are made possible by the compiler with the Google Closure Library and Angular.

Test project

You may benefit from a test sub project. Please see sbt-uglify for an example. They help with dev iterations.

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.