1.0.4 • Published 5 years ago
postcss-scss-import-dedup v1.0.4
postcss-scss-import-dedup
PostCSS plugin to remove duplicate
@import
statements.
Installation
With yarn
$ yarn add postcss-scss-import-dedup
Or npm
:
$ npm install --save postcss-scss-import-dedup
Usage
const fs = require('fs'),
postcss = require('postcss'),
syntax = require('postcss-scss'),
dedupImports = require('postcss-scss-import-dedup')
const scss = fs.readFileSync('scss/input.scss', 'utf-8')
postcss([dedupImports()]).process(scss, {
syntax: syntax,
from: 'scss/input.scss',
})
scss/input.scss
:
@import 'a';
@import 'b';
@import 'a';
Will give you:
@import 'a';
@import 'b';
Options
opts.filter
A function that receives a an import string and determines if it should be tracked by the deduper. This can be used as an escape valve while using this plugin.
Default:
null
Example:
dedupImports({
filter: importpath => {
return importpath == 'a'
}
})
Will dedup only @import 'a'
statements.
For more information see the scss-extractor documentation.
1.0.4
5 years ago
1.0.3
5 years ago
1.0.3-alpha.2
5 years ago
1.0.2
5 years ago
1.0.2-alpha.13
5 years ago
1.0.2-alpha.0
5 years ago
1.0.1-1.0.0-alpha.0.0
5 years ago