Skip to content

wiztools/css-import-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSS Import Resolver Cli

A tool which parses the CSS @import url() statement and adds the content of the file inline to the CSS. The output is by default written to the STDOUT, or using the -o option written to a file.

This tool is available as part of "The Joy of Unix in Windows Tool Bundle":

Details

In CSS you can refer to other CSS files thus:

@import url(path/to/included.css);

Such reference makes the code easy to read and maintain, but on the performance side it takes a hit---because the browser needs to make multiple HTTP requests to render this page (more detail).

This tool reads such CSS files and includes the content of the @import'ed file in the main CSS.

This can be done as a build time processing for building faster sites.

Usage

To list the command-line options:

$ java -jar css-import-resolver-NN-jar-with-dependencies.jar -h

Limitations

  1. The parsing is done using RegularExpression, so when @import statements are encountered inside CSS comments, they are also expanded.
  2. HTTP urls are not processed.

About

A cli tool written in Java to resolve @import url() in CSS file and generate one big CSS with the styles available inline

Resources

Stars

Watchers

Forks

Packages

No packages published