Skip to content

Commit

Permalink
Ready for 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
waynell committed Jan 3, 2017
1 parent 0510373 commit 1d2b9fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*Read this in other languages: [English](README.md),[简体中文](README.zh-cn.md).*

[![Build Status](https://semaphoreapp.com/api/v1/projects/d4cca506-99be-44d2-b19e-176f36ec8cf1/128505/shields_badge.svg)](https://github.com/waynell/TinyPngPlugin) [ ![Download](https://api.bintray.com/packages/waynell/maven/TinyPngPlugin/images/download.svg?version=1.0.4) ](https://bintray.com/waynell/maven/TinyPngPlugin/1.0.4/link)

### TinyPngPlugin
`TinyPngPlugin` is a Gradle plugin for [TinyPng](https://tinypng.com/), can batch optimize your images.

Expand All @@ -12,7 +14,7 @@ Before use this plugin, you need get a Tiny API Key first. Goto [Tiny Developers
Add `TinyPngPlugin` as a dependency in your main build.gradle in the root of your project:

dependencies {
classpath 'com.waynell.tinypng:TinyPngPlugin:1.0.3'
classpath 'com.waynell.tinypng:TinyPngPlugin:1.0.4'
}

Then you need to apply the plugin and configure your `tinyinfo` by adding the following lines to your `app/build.gradle`:
Expand Down
4 changes: 3 additions & 1 deletion README.zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*其它语言版本: [English](README.md),[简体中文](README.zh-cn.md).*

[![Build Status](https://semaphoreapp.com/api/v1/projects/d4cca506-99be-44d2-b19e-176f36ec8cf1/128505/shields_badge.svg)](https://github.com/waynell/TinyPngPlugin) [ ![Download](https://api.bintray.com/packages/waynell/maven/TinyPngPlugin/images/download.svg?version=1.0.4) ](https://bintray.com/waynell/maven/TinyPngPlugin/1.0.4/link)

### TinyPngPlugin
`TinyPngPlugin`是一个[TinyPng](https://tinypng.com/)的Gradle插件,它能够批量地压缩你项目中的图片

Expand All @@ -12,7 +14,7 @@
首先在根目录中的`build.gradle`文件中添加`TinyPngPlugin`的依赖:

dependencies {
classpath 'com.waynell.tinypng:TinyPngPlugin:1.0.3'
classpath 'com.waynell.tinypng:TinyPngPlugin:1.0.4'
}

然后在app目录中的`build.gradle`文件中应用该插件,并配置`tinyinfo`
Expand Down
2 changes: 1 addition & 1 deletion bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'com.jfrog.bintray'
def siteUrl = 'https://github.com/waynell' // 项目的主页
def gitUrl = 'https://github.com/waynell' // Git仓库的url
group = "com.waynell.tinypng" // Maven Group ID for the artifact,一般填你唯一的包名
version = "1.0.3"
version = "1.0.4"

install {
repositories.mavenInstaller {
Expand Down
18 changes: 10 additions & 8 deletions src/main/groovy/com/waynell/tinypng/TinyPngTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,16 @@ public class TinyPngTask extends DefaultTask {
def newCompressedList = new ArrayList<TinyPngInfo>()
configuration.resourceDir.each { d ->
def dir = new File(d)
if(!(configuration.resourcePattern ?: false)) {
configuration.resourcePattern = ["drawable[a-z-]*"]
}
configuration.resourcePattern.each { p ->
dir.eachDirMatch(~/$p/) { drawDir ->
List<TinyPngInfo> list = compress(drawDir, configuration.whiteList, compressedList)
if(list) {
newCompressedList.addAll(list)
if(dir.exists() && dir.isDirectory()) {
if (!(configuration.resourcePattern ?: false)) {
configuration.resourcePattern = ["drawable[a-z-]*"]
}
configuration.resourcePattern.each { p ->
dir.eachDirMatch(~/$p/) { drawDir ->
List<TinyPngInfo> list = compress(drawDir, configuration.whiteList, compressedList)
if (list) {
newCompressedList.addAll(list)
}
}
}
}
Expand Down

0 comments on commit 1d2b9fe

Please sign in to comment.