Socket
Socket
Sign inDemoInstall

pixrem

Package Overview
Dependencies
17
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

14

lib/pixrem.js
'use strict';
var calc = require('reduce-css-calc');
var postcss = require('postcss');
var browserslist = require('browserslist');
var _remgex, _PROPS, _VALUES, _rootvalue, _options;
var calc = require('reduce-css-calc');
var BASE_FONT_SIZE = 16;
// Add pixel fallbacks for rem units to a string of CSS

@@ -19,3 +22,3 @@ // - css `String`: the contents of a CSS file.

_VALUES = /(calc|gradient)\(/;
_rootvalue = typeof rootvalue !== 'undefined' ? rootvalue : 16;
_rootvalue = typeof rootvalue !== 'undefined' ? rootvalue : BASE_FONT_SIZE;
options = options || {};

@@ -154,6 +157,9 @@ _options = {};

else if (unit === 'em' || unit === 'rem') {
return parseFloat(number) * 16;
return parseFloat(number) * BASE_FONT_SIZE;
}
else if (unit === '%') {
return (parseFloat(number) / 100) * 16;
return (parseFloat(number) / 100) * BASE_FONT_SIZE;
} else {
// other units: vw, ex, ch, etc...
return BASE_FONT_SIZE;
}

@@ -160,0 +166,0 @@ } else {

{
"name": "pixrem",
"description": "A CSS post-processor that generates pixel fallbacks for rem units.",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "https://github.com/robwierzbowski/node-pixrem",

@@ -6,0 +6,0 @@ "author": "Rob Wierzbowski <hello@robwierzbowski.com> (http://robwierzbowski.com)",

@@ -98,2 +98,6 @@ # Pixrem

2.0.1, Sep 17, 2015
* Fix NaNpx values (#45)
2.0.0, Aug 24, 2015

@@ -100,0 +104,0 @@

@@ -57,2 +57,9 @@ // Jasmine unit tests

it('should generate fallbacks with a vw root em value', function () {
var expected = '.rule { font-size: 32px; font-size: 2rem }';
var processed = pixrem.process(css, '.625vw');
expect(processed).toBe(expected);
});
it('should generate fallbacks with a value starting with dot', function () {

@@ -59,0 +66,0 @@ var expected = '.rule { font-size: 16px; font-size: 2rem }';

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