
Partial Import is a PostCSS plugin that inlines standard and Sass-like @import
statements.
/* before file.css */ ; /* before foo/_bar.css */ /* after */
Usage
Follow these steps to use Partial Import.
Add Partial Import to your build tool:
npm install postcss-partial-import --save-dev
Node
/* options */ ;
PostCSS
Add PostCSS to your build tool:
npm install postcss --save-dev
Load Partial Import as a PostCSS plugin:
;
Gulp
Add Gulp PostCSS to your build tool:
npm install gulp-postcss --save-dev
Enable Partial Import within your Gulpfile:
var postcss = ; gulp;
Grunt
Add Grunt PostCSS to your build tool:
npm install grunt-postcss --save-dev
Enable Partial Import within your Gruntfile:
grunt; grunt;
Options
encoding
Type: String
Default: utf8
The character encoding of files being imported.
extension
Type: String
Default: css
The file extension appended to partials being imported.
prefix
Type: String
Default: _
The file extension sometimes prepended to partials being imported.
generate
Type: Boolean
Default: false
The option if partials should be generated if they do not already exist.
cachedir
Type: String
Default: null
The directory to store cached includes in. Can reduce compilation time when there are a lot of @include
s. Setting this property enables the cache.
addDependencyTo
Type: function
Default: null
To pass CSS @import files to a compiler (such as webpack), which would otherwise not know which CSS files to watch for browser reloading.
Example
// webpack.config.js { return ;}