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

postcss-normalize-charset

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-normalize-charset - npm Package Compare versions

Comparing version

to
1.1.1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 1.1.1
* Performance tweaks; test that `node.parent` is equal to the AST rather than
checking its type is `root`, and use the AST directly to prepend the
`@charset` to, rather than using the superfluous `root()` method.
# 1.1.0

@@ -2,0 +8,0 @@

12

index.js
var postcss = require('postcss');
module.exports = postcss.plugin('postcss-normalize-charset', function (opts) {
var charset = 'charset';
module.exports = postcss.plugin('postcss-normalize-' + charset, function (opts) {
opts = opts || {};

@@ -12,3 +14,3 @@

css.walk(function (node) {
if (node.type === 'atrule' && node.name === 'charset') {
if (node.type === 'atrule' && node.name === charset) {
if (!charsetRule) {

@@ -18,3 +20,3 @@ charsetRule = node;

node.remove();
} else if (!nonAsciiNode && node.parent && node.parent.type === 'root' && nonAscii.test(node)) {
} else if (!nonAsciiNode && node.parent === css && nonAscii.test(node)) {
nonAsciiNode = node;

@@ -27,3 +29,3 @@ }

charsetRule = postcss.atRule({
name: 'charset',
name: charset,
params: '"utf-8"'

@@ -34,3 +36,3 @@ });

charsetRule.source = nonAsciiNode.source;
css.root().prepend(charsetRule);
css.prepend(charsetRule);
}

@@ -37,0 +39,0 @@ }

{
"name": "postcss-normalize-charset",
"version": "1.1.0",
"version": "1.1.1",
"description": "Add necessary or remove extra charset with PostCSS",

@@ -16,7 +16,7 @@ "keywords": [

"license": "MIT",
"repository": "TrySound/postcss-charset",
"repository": "ben-eb/postcss-charset",
"bugs": {
"url": "https://github.com/TrySound/postcss-charset/issues"
"url": "https://github.com/ben-eb/postcss-charset/issues"
},
"homepage": "https://github.com/TrySound/postcss-charset",
"homepage": "https://github.com/ben-eb/postcss-charset",
"dependencies": {

@@ -26,9 +26,9 @@ "postcss": "^5.0.5"

"devDependencies": {
"ava": "^0.16.0",
"eslint": "^1.4.1",
"tap-spec": "^4.1.0",
"tape": "^4.2.0"
"postcss-devtools": "^1.1.1"
},
"scripts": {
"test": "eslint index.js test && tape test/*.js | tap-spec"
"test": "eslint index.js test && ava"
}
}

@@ -43,3 +43,3 @@ # postcss-normalize-charset [![Build Status][ci-img]][ci]

[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/TrySound/postcss-normalize-charset.svg
[ci]: https://travis-ci.org/TrySound/postcss-normalize-charset
[ci-img]: https://travis-ci.org/ben-eb/postcss-normalize-charset.svg
[ci]: https://travis-ci.org/ben-eb/postcss-normalize-charset

Sorry, the diff of this file is not supported yet