[ https://issues.apache.org/jira/browse/WICKET-5827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14305458#comment-14305458 ]
ASF GitHub Bot commented on WICKET-5827: ---------------------------------------- Github user klopfdreh commented on a diff in the pull request: https://github.com/apache/wicket/pull/87#discussion_r24096380 --- Diff: wicket-core/src/main/java/org/apache/wicket/resource/CompositeJavaScriptCompressor.java --- @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.resource; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.wicket.javascript.IJavaScriptCompressor; + +/** + * Used to apply several {@link IJavaScriptCompressor} to the javascript compression.<br> + * <br> + * Usage: + * + * <pre> + * CompositeJavaScriptCompressor compositeJavaScriptCompressor = new CompositeJavaScriptCompressor(); + * + * compositeJavaScriptCompressor.getCompressors().add(new MyJavaScriptCompressor()); + * compositeJavaScriptCompressor.getCompressors().add(new AnotherJavaScriptCompressor()); + * + * this.getResourceSettings().setJavaScriptCompressor(compositeJavaScriptCompressor); + * </pre> + * The compressors can also be given as constructor arguments. + * + * @since 6.20.0 + * @author Tobias Soloschenko + * + */ +public class CompositeJavaScriptCompressor implements IJavaScriptCompressor +{ + + /* Compressors to compress javascript content */ + private List<IJavaScriptCompressor> compressors = new ArrayList<>(); + + /** + * Initializes an empty composite javascript compressor + */ + public CompositeJavaScriptCompressor() + { + } + + /** + * Initializes the composite javascript compressor with the given {@link IJavaScriptCompressor} + * + * @param compressors + * several {@link IJavaScriptCompressor} the composite javascript compressor is + * initialized with + */ + public CompositeJavaScriptCompressor(IJavaScriptCompressor... compressors) + { + this.compressors = Arrays.asList(compressors); --- End diff -- done > Allow to apply multiple Javascript / CSS compressors > ---------------------------------------------------- > > Key: WICKET-5827 > URL: https://issues.apache.org/jira/browse/WICKET-5827 > Project: Wicket > Issue Type: New Feature > Components: wicket > Affects Versions: 6.20.0, 7.0.0-M6 > Reporter: Tobias Soloschenko > Priority: Minor > Labels: features > > It would be nice to be able to add several css and javascript compressions in > a chain. Example for CSS: > CssRemoveCommentsCompressor > CssUrlReplacementCompressor > > CssMinifyCompressor > The same would be nice for JavaScript files. > https://github.com/apache/wicket/pull/88 > https://github.com/apache/wicket/pull/87 -- This message was sent by Atlassian JIRA (v6.3.4#6332)