
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
saladcss-partial-import
Advanced tools
Partial Import is a PostCSS plugin that inlines standard and Sass-like @import statements.
/* before file.css */
@import "foo/bar";
/* before foo/_bar.css */
html {
background-color: #fafafa;
}
/* after */
html {
background-color: #fafafa;
}
Follow these steps to use Partial Import.
Add Partial Import to your build tool:
npm install postcss-partial-import --save-dev
require('postcss-partial-import')({ /* options */ }).process(YOUR_CSS);
Add PostCSS to your build tool:
npm install postcss --save-dev
Load Partial Import as a PostCSS plugin:
postcss([
require('postcss-partial-import')({ /* options */ })
]);
Add Gulp PostCSS to your build tool:
npm install gulp-postcss --save-dev
Enable Partial Import within your Gulpfile:
var postcss = require('gulp-postcss');
gulp.task('css', function () {
return gulp.src('./css/src/*.css').pipe(
postcss([
require('postcss-partial-import')({ /* options */ })
])
).pipe(
gulp.dest('./css')
);
});
Add Grunt PostCSS to your build tool:
npm install grunt-postcss --save-dev
Enable Partial Import within your Gruntfile:
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
postcss: {
options: {
processors: [
require('postcss-partial-import')({ /* options */ })
]
},
dist: {
src: 'css/*.css'
}
}
});
encodingType: String
Default: utf8
The character encoding of files being imported.
extensionType: String
Default: css
The file extension appended to partials being imported.
prefixType: String
Default: _
The file extension sometimes prepended to partials being imported.
generateType: Boolean
Default: false
The option if partials should be generated if they do not already exist.
cachedirType: String
Default: null
The directory to store cached includes in. Can reduce compilation time when there are a lot of @includes. Setting this property enables the cache.
addDependencyToType: 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
postcss: function(webpack) {
return [
precss({ addDependencyTo: webpack })
];
},
FAQs
PostCSS plugin that imports like Sass
We found that saladcss-partial-import demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.