Socket
Socket
Sign inDemoInstall

postcss-amp

Package Overview
Dependencies
4
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 2.0.0

14

at-rules.js

@@ -1,2 +0,2 @@

'use strict'
'use strict';

@@ -9,17 +9,15 @@ // See https://www.ampproject.org/docs/reference/validation_errors

'namespace',
'supports',
'document',
'page',
'viewport',
'-ms-viewport'
])
]);
function removeDisallowedAtRules (root) {
function removeDisallowedAtRules(root) {
root.walkAtRules(rule => {
if (disallowedAtRules.has(rule.name)) {
rule.remove()
rule.remove();
}
})
});
}
module.exports = removeDisallowedAtRules
module.exports = removeDisallowedAtRules;

@@ -1,6 +0,6 @@

'use strict'
'use strict';
const { plugin } = require('postcss')
const { plugin } = require('postcss');
const removeDisallowedAtRules = require('./at-rules')
const removeDisallowedAtRules = require('./at-rules');

@@ -13,15 +13,15 @@ module.exports = plugin('postcss-amp', () => {

root.walkDecls(decl => {
decl.important = false
})
decl.important = false;
});
// Removes selectors
root.walkRules(/\.-amp-|^i-amp|\si-amp/, selector => {
selector.parent.removeChild(selector)
})
selector.parent.removeChild(selector);
});
// Removing properties
root.walkDecls(/behavior|-moz-binding|filter/, decl => {
let { parent } = decl
parent.removeChild(decl)
let { parent } = decl;
parent.removeChild(decl);
// remove whole selector if it empty
if (!parent.nodes.length) parent.parent.removeChild(parent)
})
if (!parent.nodes.length) parent.parent.removeChild(parent);
});
// Restricted styles

@@ -34,12 +34,12 @@

if (!/opacity|transform/.test(decl.value)) {
let { parent } = decl
parent.removeChild(decl)
let { parent } = decl;
parent.removeChild(decl);
// remove whole selector if it empty
if (!parent.nodes.length) parent.parent.removeChild(parent)
if (!parent.nodes.length) parent.parent.removeChild(parent);
}
})
});
// Remove disallowed at-rules
removeDisallowedAtRules(root)
}
})
removeDisallowedAtRules(root);
};
});
{
"name": "postcss-amp",
"version": "1.4.0",
"version": "2.0.0",
"description": "PostCSS plugin to convert CSS according Accelerated Mobile Pages requirements",

@@ -24,3 +24,3 @@ "keywords": [

"engines": {
"node": ">=6.0.0"
"node": ">=8.0.0"
},

@@ -35,19 +35,13 @@ "bugs": {

"devDependencies": {
"@logux/eslint-config": "28.2.2",
"@types/jest": "24.0.15",
"eslint": "5.16.0",
"eslint-config-postcss": "3.0.7",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-import-helpers": "1.0.1",
"eslint-plugin-jest": "22.6.4",
"@types/jest": "24.0.18",
"eslint": "6.2.0",
"eslint-config-prettier": "6.1.0",
"eslint-plugin-node": "9.1.0",
"eslint-plugin-prefer-let": "1.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-security": "1.4.0",
"eslint-plugin-standard": "4.0.0",
"jest": "24.8.0",
"postcss": "7.0.2"
"eslint-plugin-prettier": "3.1.0",
"jest": "24.9.0",
"postcss": "7.0.17",
"prettier": "1.18.2"
},
"scripts": {
"lint": "eslint *.js --ignore-path .gitignore",
"test": "jest && eslint *.js --ignore-path .gitignore"

@@ -57,17 +51,10 @@ },

"plugins": [
"jest"
"prettier",
"node"
],
"extends": "eslint-config-postcss",
"rules": {
"jest/no-identical-title": 2,
"jest/expect-expect": [
"error",
{
"assertFunctionNames": [
"expect",
"run"
]
}
]
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:node/recommended"
],
"env": {

@@ -74,0 +61,0 @@ "jest": true,

# PostCSS Amp [![NPM version](http://img.shields.io/npm/v/postcss-amp.svg)](https://www.npmjs.org/package/postcss-amp) [![Build Status](https://travis-ci.org/tinovyatkin/postcss-amp.svg?branch=master)](https://travis-ci.org/tinovyatkin/postcss-amp)
[![Greenkeeper badge](https://badges.greenkeeper.io/tinovyatkin/postcss-amp.svg)](https://greenkeeper.io/)
> PostCSS plugin to convert CSS according Accelerated Mobile Pages requirements [![amp-logo](https://www.ampproject.org/static/img/logo-blue.svg)].
> PostCSS plugin to convert CSS according Accelerated Mobile Pages requirements.
<img src="https://status.ampproject.org/static/img/logo-blue.svg" style="float: left; margin-right: 20px" />
AMP CSS requirements: <https://github.com/tinovyatkin/postcss-amp>
AMP CSS requirements: <https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/style_pages/>
<hr/>
Input:
```css

@@ -20,2 +25,4 @@ i-amp-el {

Output:
```css

@@ -22,0 +29,0 @@ .boo {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc