Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (64 sloc) 2.25 KB


Importers are an experimental feature of libsass. They allow to manipulate the way how @import works.


The import source string must be in SCSS syntax. SASS syntax is not supported yet!

In jsass importers must implement the io.bit3.jsass.importer.Importer interface.

.. literalinclude:: examples/
   :language: java

Then register the object instance to the options.

options.getImporters().add(new MyImporter());

Thats all! From now on, each @import will be passed through your custom importer.

Skip importer

If you importer should be skipped, just return null.

Skip import

Sometimes you may want to omit an @import directive. In this case, return an empty list.

Import a file

Importing a file is one of the basic ways to import a source. Fill the Import#importUri with the relative file name and the Import#absoluteUri with the absolute file path, leave everything else empty. libsass will search the file in the path and import it.

Import fileImport = new Import(
        new URI("import.scss"),
        new File("public/assets/import.scss").toURI()

Import a string

Importing a string is as simple as importing a file. Just add the string contents to the import.

String contents = ".hello { content: 'Hello world'! }";

Import fileImport = new Import(
        new URI("import.scss"),
        new File("public/assets/import.scss").toURI(),