🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

postcss-partial-import

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-partial-import

PostCSS plugin that imports like Sass

1.3.0
Source
npm
Version published
Maintainers
1
Created
Source

Partial Import Build Status

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;
}

Usage

Follow these steps to use Partial Import.

Add Partial Import to your build tool:

npm install postcss-partial-import --save-dev

Node

require('postcss-partial-import')({ /* options */ }).process(YOUR_CSS);

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Partial Import as a PostCSS plugin:

postcss([
    require('postcss-partial-import')({ /* options */ })
]);

Gulp

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')
    );
});

Grunt

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'
        }
    }
});

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.

cachedir

Type: 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.

Keywords

postcss

FAQs

Package last updated on 14 Sep 2015

Did you know?

Socket

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.

Install

Related posts