Consume @import
in css recursively.
@import
node-style modules- Resolve the module entry according to the
style
field ofpackage.json
rather thanmain
- Files are imported only once
Specify the name of at-rules to be processed.
Type: String
Default: import
Specify how to load files when processing @import
.
Type: Function
Signature: importer(url, from, opts)
url
:@import "url";
from
: the absolute path of the current css fileopts
: the options object
opts.postcssOpts
is accessible.
Should return an array of objects (or promises) with the following fields:
from
: String required the resolved file pathsource
: String optional the contents of the file
If undefined
returned, the importer
will be ignored.
File contents cache.
Specify how to read file contents.
Type: Function
Signature: readFile(filename)
Should return a string (or promise) of contents of the file.
Specify how to resolve globs.
It should have glob.hasMagic(url)
to check whether globs exist.
Type: Function
Receives the glob string, and an object { cwd: dirname_of_the_processed_file }
.
Should return an array (or a promise) of file paths.
Type: true
A promisified version of glob is used.
Specify how to resolve file paths.
Type: Function
Receives the import string, and an object { basedir: dirname_of_the_processed_file }
.
Should return an absolute file path (or promise).
Type: Object
Passed to custom-resolve to create the resolve function.
var resolver = require('custom-resolve')
opts.resolve = promisify(resolver(mix({
packageEntry: 'style',
extensions: '.css',
symlinks: true, // resolve all soft links to their real paths
}, opts.resolve)))
Specify how to build an AST from the source.
Type: Function
Signature: parse(source, from)
Should return the AST object (or promise).
Deprecated
Use the imports event instead.
Type: Function
Signature: onImport(from, imports, postcssOpts)
from
: the css fileimports
: files directly imported byfrom
postcssOpts
: postcssOpts
Event listeners.
Type: Object
Fired right after file path resolved, but before compilation.
Listener signature: fn(importedFile, from, opts)
opts.postcssOpts
is accessible.
Fired right after compilation.
Listener signature: fn(imports, from, opts)
imports
:Array
opts.postcssOpts
is accessible.
Type: Object
Options passed to process(source, postcssOpts)