postcss-normalize-charset
Advanced tools
Comparing version 1.0.0 to 1.1.0
12
index.js
var postcss = require('postcss'); | ||
module.exports = postcss.plugin('postcss-normalize-charset', function () { | ||
module.exports = postcss.plugin('postcss-normalize-charset', function (opts) { | ||
opts = opts || {}; | ||
return function (css) { | ||
@@ -21,3 +23,3 @@ var charsetRule; | ||
if (nonAsciiNode) { | ||
if (!charsetRule) { | ||
if (!charsetRule && opts.add !== false) { | ||
charsetRule = postcss.atRule({ | ||
@@ -28,6 +30,8 @@ name: 'charset', | ||
} | ||
charsetRule.source = nonAsciiNode.source; | ||
css.root().prepend(charsetRule); | ||
if (charsetRule) { | ||
charsetRule.source = nonAsciiNode.source; | ||
css.root().prepend(charsetRule); | ||
} | ||
} | ||
}; | ||
}); |
{ | ||
"name": "postcss-normalize-charset", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Add necessary or remove extra charset with PostCSS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -18,2 +18,16 @@ # postcss-normalize-charset [![Build Status][ci-img]][ci] | ||
## API | ||
### normalizeCharset([options]) | ||
#### options | ||
##### add | ||
Type: `boolean` | ||
Default: `true` | ||
Pass `false` to stop the module from adding a `@charset` declaration if it was | ||
missing from the file (and the file contained non-ascii characters). | ||
## Usage | ||
@@ -20,0 +34,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3902
5
31
45