AndersDJohnson / AndersDJohnson/htmlcompressor

Extend HTML compressor to compress and combine external files

Đang mở
#92 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
auto-migrated Priority-Medium Type-Defect
Ngôn ngữ chính
Java
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

```
Hello,

I'm compressing HTML files referencing external CSS and Javascript scripts. I
would like to set a particular compressor to the HTMLCompressor through Java
API that is used each time an external script is detected.

My compressor will be in charge to load the files thanks to the given paths,
compress and combine it and then return the new path to add as external script.

API proposal:

// new interface
interface ExternalCompressor {
String compress(List path, Compressor defaultCompressor);
}

// new setter
htmlCompressor.setExternalCompressor((paths, defaultCompressor) -> {
// implementation sample skeleton
paths.forEach((path) -> {
File f = new File(baseDir, path);
String content = ...
defaultCompressor.compress(content);
...
}

return combinedPath;
});

Result:

</head>
<body>
<script src="bottom1.js" />
<script src="bottom2.js" />
</body>
</html>

// gives
<html>
<head>>
<link rel="/custom-path/bar.min.css" />
<script src="/custom-path/foo.min.js" /
</head>
<body>
<script src="/custom-path/combine.min.js" /
</body>
</html>

Thanks!

```

Original issue reported on code.google.com by `guidro...@gmail.com` on 21 Feb 2014 at 1:50

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.