All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.alchim.mojo.yuicompressor.SourceFile Maven / Gradle / Ivy

Go to download

To compress (Minify + Ofuscate) Javascript files and CSS files (using YUI Compressor from Julien Lecomte) and/or to check Javascript files with jslint.

There is a newer version: 0.7.1
Show newest version
package net.sf.alchim.mojo.yuicompressor;

import java.io.File;

public class SourceFile {

    private File root_;
    private String rpath_;
    private String extension_;

    public SourceFile(File root, String name) throws Exception {
        root_ = root;
        rpath_ = name;
        int sep = rpath_.lastIndexOf('.');
        if (sep>0) {
            extension_ = rpath_.substring(sep);
            rpath_ = rpath_.substring(0, sep);
        } else {
            extension_ = "";
        }
    }

    public File toFile() {
        return new File(root_, rpath_ + extension_);
    }

    public File toDestFile(File destRoot, String suffix) {
        return new File(destRoot, rpath_ + suffix + extension_);
    }

    public String getExtension() {
        return extension_;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy