Class AbstractMinimizeManager

    • Method Detail

      • minimizeAndAggregateURIs

        public String minimizeAndAggregateURIs​(List<HashCache.UriData> uris,
                                               String fileName,
                                               boolean generateSourceMap)
        Compile a list of css URI, store the generated source map and returns the minimized concatenated result
        Parameters:
        uris - The URIs to compile, e.g a list of mixed .min.css and .css URIs
        fileName - The name of the result without extension, e.g. HASH
        generateSourceMap - True to generate the source map
        Returns:
        The minimized file
      • applyMediaToContent

        protected String applyMediaToContent​(String content,
                                             String media)
        Defaut implementation to apply a media to a content.
        Parameters:
        content - The content
        media - The media
        Returns:
        The content with the media
      • _generateSourceMap

        private void _generateSourceMap​(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator,
                                        StringBuffer sb,
                                        String fileName,
                                        String sourceMapName,
                                        boolean generateSourceMap)
      • validateAndOutputMinimizedFile

        public void validateAndOutputMinimizedFile​(Source source,
                                                   OutputStream out,
                                                   String sourceUri)
                                            throws IOException
        Validate a source, fix it if required, and output the result to the output stream.
        Parameters:
        source - The source
        out - The output
        sourceUri - The source uri
        Throws:
        IOException - If an error occurred while reading the source
      • isSourceMappingURLLine

        protected abstract boolean isSourceMappingURLLine​(String line)
        Test if the line contains a source mapping URL
        Parameters:
        line - The line
        Returns:
        True if a source mapping url is found
      • getSourceMappingURL

        protected abstract String getSourceMappingURL​(String line)
        Get the source mapping URL value from the line
        Parameters:
        line - The line
        Returns:
        The source mapping URL
      • removeSourceMappingURLLine

        protected abstract String removeSourceMappingURLLine​(String content)
        Remove the source mapping url from the content
        Parameters:
        content - The content
        Returns:
        The content without the mention of the source mapping URL
      • formatSourceMappingURL

        protected abstract String formatSourceMappingURL​(String sourceMapName)
        Format a source mapping URL to be added at the end of a minimized file
        Parameters:
        sourceMapName - The map name
        Returns:
        The source mapping URL line
      • getMinimizedContent

        protected abstract String getMinimizedContent​(String uri,
                                                      String nestedParentFilesName)
        Get the minimized content at the specified URI
        Parameters:
        uri - The uri
        nestedParentFilesName - The parents file name, can be an empty string if there are no parents
        Returns:
        The minimized content of the specified URI
      • addSourceMap

        protected abstract void addSourceMap​(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator,
                                             int lineCount,
                                             String fileContent,
                                             String fileUri,
                                             String sourceMapUri)
        Aggregate the source map of the single file with the others
        Parameters:
        sourceMapGenerator - The aggregator helper
        lineCount - The current line count
        fileContent - The content of the file
        fileUri - The uri of the file
        sourceMapUri - The sourceMappingURL found at the end of the file content