
net_alchim31_maven_yuicompressor.SourceFile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yuicompressor-maven-plugin-zk Show documentation
Show all versions of yuicompressor-maven-plugin-zk Show documentation
To compress (Minify + Ofuscate) Javascript files and CSS
files (using YUI Compressor from Julien Lecomte).
--Modified from [net.alchim31.maven] [yuicompressor-maven-plugin]
And remove the jslint we didnt need , and customize the css compressor from
yui for working with *.css.dsp
It's a really good project for that , thanks a lot.
The newest version!
package net_alchim31_maven_yuicompressor;
import java.io.File;
public class SourceFile {
private File srcRoot_;
private File destRoot_;
private boolean destAsSource_;
private String rpath_;
private String extension_;
public SourceFile(File srcRoot, File destRoot, String name, boolean destAsSource) throws Exception {
srcRoot_ = srcRoot;
destRoot_ = destRoot;
destAsSource_ = destAsSource;
rpath_ = name;
int sep = rpath_.lastIndexOf('.');
if (sep>0) {
extension_ = rpath_.substring(sep);
rpath_ = rpath_.substring(0, sep);
} else {
extension_ = "";
}
}
public File toFile() {
String frpath = rpath_ + extension_;
if (destAsSource_) {
File defaultDest = new File(destRoot_, frpath);
if (defaultDest.exists() && defaultDest.canRead()) {
return defaultDest;
}
}
return new File(srcRoot_, frpath);
}
public File toDestFile(String suffix) {
return new File(destRoot_, rpath_ + suffix + extension_);
}
public String getExtension() {
return extension_;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy