Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A JSON minification plugin / asset compiler for the Play! Framework

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .settings
Octocat-spinner-32 project
Octocat-spinner-32 src
Octocat-spinner-32 .classpath
Octocat-spinner-32 .gitignore remove bin and ignore it June 14, 2012
Octocat-spinner-32 .project
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 _0112_20.sh
Octocat-spinner-32 _0113_21.sh
Octocat-spinner-32 build.sbt
Octocat-spinner-32 ivy.xml
README.md

play-jsonminify - JSON minification compiler for Play 2.0

About

This plugin is initially based on Ray and play-stylus.

play-jsonminify is a JSON 'compiled asset plugin' for Play 2.0 based on JSON.simple. It is similar to the other built-in compilers. JSON files placed under app/assets will be transformed into a pretty-printed and a compressed version.

For example, JSON in app/assets/javascripts/xyz.json

will be automatically compiled into a pretty-printed version, when requested via public/javascripts/xyz.json:

and a compressed version when requested via public/javascripts/xyz.min.json:

Compile time errors (such as unclosed brackets or unexpected characters) will cause a nice Play error page:

As you can see on line 3, leaving out commas is not necessarily breaking the compiler. As well as unnecessary trailing commas will be stripped automatically. (thanks to JSON.simple).

Installation

Add the plugin and the repository to your application's project/plugins.sbt:

resolvers += "Play JSONminify repository" at "http://joscha.github.com/play-jsonminify/repo/"

addSbtPlugin("com.feth" % "play-jsonminify" % "0.1.0")

This adds the JSON asset compiler to your Play project. *.json files beneath app/assets will then be automatically compiled to *.json and *.min.json files. Files starting with _-character will be left out from compilation as per Play convention.

Installation (build from source)

First you must publish the plugin to your Play 2.0 repository. You will have to specify your top level play directory and the version:

sbt -Dplay.path=../play-2.0.1 -Dplay.version=2.0.1 publish

Then add the plugin to your application's project/plugins.sbt:

addSbtPlugin("com.feth" % "play-jsonminify" % "0.1.0")

Settings

To override the default settings, you can add the following lines to the settings call in your Build.scala (examples):

this would for example also process JSON files starting with the _-character:

jsonminifyEntryPoints <<= (sourceDirectory in Compile)(base => base / "assets" ** "*.json")

Versions

  • 0.1.0 [2012-05-18] Initial release

License

Copyright (c) 2012 Joscha Feth

MIT-style license, see details from LICENSE file.

Something went wrong with that request. Please try again.