- Google Javascript Closure Compiler
https://kwonnam.pe.kr/wiki/javascript/performance/closurecompiler

https://developers.google.com/closure/compiler/docs/gettingstarted_app?hl=ko


- gradle-js-plugin, gradle-css-plugin
https://yookeun.github.io/java/2016/07/31/gradle-minify/

https://ddakker.tistory.com/325


- gradle plugins 종류
https://plugins.gradle.org/search?term=minify


- com.google.javascript > closure-compiler
https://github.com/google/closure-compiler/wiki/

https://stackoverflow.com/questions/68831061/how-to-use-the-google-closure-compiler-to-optimize-kotlin-js


https://gist.github.com/koizuss/3696344#file-build-gradle


https://kwonnam.pe.kr/wiki/javascript/performance/closurecompiler

https://stackoverflow.com/questions/53340258/minify-javascript-using-the-google-closure-compiler-and-gradle


- google > closure-stylesheets
https://github.com/google/closure-stylesheets


- scss
https://github.com/matsuyoido/gradle-frontend-plugin

- sass
https://github.com/leobia/SassGradleCompiler


https://www.wenyanet.com/opensource/ko/607776c471df7173434a6796.html


- gradle-webtools > gradle-minify-plugin
https://github.com/gradle-webtools/gradle-minify-plugin

https://hulint.tistory.com/56?category=993463

plugins {
    id "org.gradlewebtools.minify" version "1.1.1"
}

ext{
    resourcePath = "target/resources/main/public";
    minifiedPath = "target/minified"
}

// src/main/resources/public/js 파일들을 minifiy 하여 /target/minified/js 경로에 생성
task jsMinify(type: org.gradlewebtools.minify.JsMinifyTask) {
    srcDir = project.file("src/main/resources/public/js")
    dstDir = project.file("${minifiedPath}/js")
    options.originalFileNames = true
}

// src/main/resources/public/css 파일들을 minifiy 하여 /target/minified/css 경로에 생성
task cssMinify(type: org.gradlewebtools.minify.CssMinifyTask) {
    srcDir = project.file("src/main/resources/public/css")
    dstDir = project.file("${minifiedPath}/css")
    options.originalFileNames = true
}

// minified된 파일을 target/resources/main/public 경로에 복사한다.
task applyMinify(type: Copy){
    dependsOn jsMinify
    dependsOn cssMinify
    
    from project.file("${minifiedPath}")
    into project.file("${resourcePath}")
}	

/*
  bootJar 실행시에 /src/main/resources에 있는 파일들이 /targer/resources로 복사된다.
  복사시에 minified된 css, js 경로는 제외 시킨다.
*/
processResources {
    exclude("**/css/**","**/js/**")
}

// bootJar task실행시에 applyMinify task가 동작하도록 dependsOn 설정 
bootJar{
    enabled = true
    baseName = "${rootProject.name}"
    version = '0.1-SNAPSHOT'

    dependsOn applyMinify
}

출처: https://hulint.tistory.com/56?category=993463 [후린트 홈:티스토리]




- minify 실패시 skip
https://stackoverflow.com/questions/50915054/gradle-minifyjs-skip-file-if-failed








'gradle' 카테고리의 다른 글

gradle 입문  (0) 2022.07.30
View Gradle dependency tree in Eclipse  (0) 2022.07.29
gradle bootRun JVM options  (0) 2022.06.09
gradle build command with version number  (0) 2022.05.14
Skipping Tests With Gradle  (0) 2022.03.08
Posted by 張's blog
,