[ 
https://issues.apache.org/jira/browse/WICKET-5827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14305385#comment-14305385
 ] 

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_r24094203
  
    --- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
    @@ -0,0 +1,144 @@
    +/*
    + * 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.io.PrintWriter;
    +import java.io.StringWriter;
    +import java.net.URL;
    +import java.util.Collection;
    +import java.util.Collections;
    +import java.util.LinkedHashMap;
    +import java.util.Map;
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +import org.apache.wicket.Application;
    +import org.apache.wicket.Component;
    +import org.apache.wicket.Page;
    +import org.apache.wicket.WicketRuntimeException;
    +import org.apache.wicket.application.IComponentInitializationListener;
    +import org.apache.wicket.css.ICssCompressor;
    +import org.apache.wicket.request.cycle.RequestCycle;
    +import org.apache.wicket.request.resource.PackageResourceReference;
    +
    +/**
    + * This compressor is used to replace url within css files with resources 
that belongs to their
    + * corresponding page classes. The compress method is not compressing any 
content, but replacing the
    + * URLs with Wicket representatives.<br>
    + * <br>
    + * Usage:
    + * 
    + * <pre>
    + * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
    + * </pre>
    + * 
    + * @since 6.20.0
    + * @author Tobias Soloschenko
    + * 
    + */
    +public class CssUrlReplacementCompressor implements ICssCompressor
    +{
    +
    +   // Holds the names of pages
    +   private Map<String, String> pageNames = Collections.synchronizedMap(new 
LinkedHashMap<String, String>());
    +
    +   // The pattern to find URLs in CSS resources
    +   private Pattern urlPattern = 
Pattern.compile("url\\(['|\"](.*)['|\"]\\)");
    --- End diff --
    
    This is not possible because of Arrays.asList(compressors); in constructor


> 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)

Reply via email to