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

com.fastchar.extjs.accepter.FastExtAppJsAccepter Maven / Gradle / Ivy

There is a newer version: 2.2.2
Show newest version
package com.fastchar.extjs.accepter;

import com.fastchar.core.FastChar;
import com.fastchar.core.FastEngine;
import com.fastchar.extjs.FastExtConfig;
import com.fastchar.extjs.compress.YuiCompress;
import com.fastchar.interfaces.IFastScannerAccepter;
import com.fastchar.utils.FastStringUtils;

import java.io.File;

public class FastExtAppJsAccepter implements IFastScannerAccepter {
    @Override
    public boolean onScannerClass(FastEngine engine, Class scannedClass) throws Exception {
        return false;
    }

    @Override
    public boolean onScannerFile(FastEngine engine, File file) throws Exception {
        FastExtConfig extConfig = engine.getConfig(FastExtConfig.class);
        if (extConfig.isCompressAppJs()) {
            if (file.getName().endsWith(".js")) {
                String filePath = file.getPath();
                filePath = FastStringUtils.strip(filePath.replace(engine.getPath().getWebRootPath(), ""), "/");
                if (filePath.startsWith("app/")) {
                    YuiCompress.compress(file.getPath());
                }
            }
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy