PostCSS plugin that inlines @import rules
open sourceMITfree
postcss-import is a PostCSS plugin that replaces CSS @import rules with the content of the imported files, so later plugins see one stylesheet. It resolves imports from local files, node_modules (using a package's style or main field, or its index.css) and web_modules, or from paths you give it, imports each file once per scope, and follows the CSS @import rules on ordering. Run it first in your PostCSS plugin list. Install it from npm as postcss-import.
Problems it solves
- bundle my CSS @import files into one stylesheet at build time
- import a CSS file from an npm package in my stylesheet
- stop the browser making extra requests for each CSS @import
Features
- inlines @import rules
- resolves imports from node_modules, web_modules and local files
- imports each file once per scope (skipDuplicates option)
- custom lookup paths and a filter option
Alternatives
The same job
These do what postcss-import does.
- Lightning CSS An extremely fast CSS parser, transformer, bundler, and minifier
- Autoprefixer Adds CSS vendor prefixes using Can I Use data
- PostCSS A tool for transforming CSS with JavaScript
- cssnano A modular CSS minifier built on PostCSS
