Socket
Socket
Sign inDemoInstall

cssgrace

Package Overview
Dependencies
12
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 3.0.0

appveyor.yml

13

CHANGELOG.md

@@ -1,3 +0,10 @@

# CSS Grace
# Change Log
## V 3.0.0 (2015-11-11) :dog::dog::dog:
* \+ Use PostCSS 5.0 API #39 (Thanks @yuezk).
* \+ Add Appveyor build test.
* \* Fix image relative path error #38.
## V 2.0.2 (2015-03-25)

@@ -13,3 +20,3 @@

\+ Image Path supports a relative path.
\+ Image Path supports a relative path.
\+ Surpporting Base64 encoding images.

@@ -19,2 +26,2 @@

> First release
> First release

@@ -16,3 +16,3 @@ var path = require('path'),

var reBEFORE_AFTER = /::|:(before|after)/gi;
var reBASE64 = /^data:image\/png;base64,/;
var reBASE64 = /^data:image\/(png|jpg|jpeg|gif);base64,/;

@@ -34,3 +34,3 @@

//存在时删掉它
neighbor.removeSelf();
neighbor.remove();
}

@@ -54,3 +54,3 @@ });

) {
neighbor.removeSelf();
neighbor.remove();
}

@@ -81,6 +81,6 @@ });

if (hasPosition && hasWidth && hasHeight) {
var widthValue, heightValue;
var widthValue, heightValue, matchWidth, matchHeight;
if (decl.prop == 'position') {
decl.value = 'absolute';
decl.parent.eachDecl(function(decl) {
decl.parent.walkDecls(function(decl) {

@@ -92,3 +92,2 @@ if (decl.prop == 'width') {

}
}

@@ -104,3 +103,3 @@ if (decl.prop == 'height') {

//在后面插入计算的内容
var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')

@@ -139,7 +138,7 @@ insertDecl(decl, i, {

if (decl.prop == 'text-overflow' && decl.value == 'ellipsis') {
var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')
var countOverflow = 0,
countWhitespace = 0;
decl.parent.eachDecl(function(decl) {
decl.parent.walkDecls(function(decl) {
// 如果存在 overflow 且不等于 hidden, 增加 white-space

@@ -192,3 +191,3 @@ if (decl.prop == 'overflow') {

var count = 0;
decl.parent.eachDecl(function(decl) {
decl.parent.walkDecls(function(decl) {
if (decl.prop == 'overflow')

@@ -198,3 +197,3 @@ count++;

if (count === 0) {
var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')

@@ -223,3 +222,3 @@ insertDecl(decl, i, {

//当存在这些属性的时候不生成伪元素
decl.parent.eachDecl(function(decl) {
decl.parent.walkDecls(function(decl) {
if (

@@ -264,5 +263,5 @@ (decl.prop == "overflow" && decl.value != 'visible') ||

if (decl.next() && decl.next().type == "comment") {
decl.next().removeSelf();
decl.next().remove();
}
decl.removeSelf();
decl.remove();
}

@@ -281,3 +280,3 @@ }

var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1');

@@ -311,3 +310,3 @@ insertDecl(decl, i, {

// 插入IE半透明滤镜
var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')
insertDecl(decl, i, {

@@ -337,3 +336,3 @@ before: reBefore,

var reBefore = decl.before.replace(reBLANK_LINE, '$1')
var reBefore = decl.raws.before.replace(reBLANK_LINE, '$1')

@@ -411,3 +410,3 @@ insertDecl(decl, i, {

selector: decl.parent.selector,
after: decl.parent.after,
after: decl.parent.raws.after,
before: '\n '

@@ -431,3 +430,3 @@ });

//没有image-set,执行以下
var retinaPaths = returnURL(decl.value, reNO_SETURL) //获取第一个url图片的路径
var retinaPaths = returnURL(decl.value, reNO_SETURL); //获取第一个url图片的路径

@@ -467,3 +466,3 @@ // var retinaSizes = sizeOf(getAbsolutePath(retinaPaths[0][2]));

declAfter;
if (next && next.type == 'comment' && next.before.indexOf('\n') == -1) {
if (next && next.type == 'comment' && next.raws.before.indexOf('\n') == -1) {
declAfter = next;

@@ -486,3 +485,3 @@ } else {

//遍历 decl
rule.eachDecl(function(decl, i) {
rule.walkDecls(function(decl, i) {
removeDisplay(decl, i);

@@ -498,7 +497,7 @@ ieInlineBlockHack(decl, i);

rule.eachDecl(function(decl, i) {
rule.walkDecls(function(decl, i) {
clearfixMixin(decl, i);
});
rule.eachDecl(function(decl, i) {
rule.walkDecls(function(decl, i) {
positionCenterMixin(decl, i);

@@ -512,3 +511,3 @@ removeFloat(decl, i);

function returnURL(val, reg) {
var result, paths = []
var result, paths = [];
while ((result = reg.exec(val)) != null) {

@@ -528,7 +527,13 @@ paths.push(result);

function getCurrentFilePath(node) {
var inputfile = node.source && node.source.input && node.source.input.file;
var dirname = inputfile ? path.dirname(inputfile) : '';
return dirname;
}
// PostCSS Processor
var cssprocess = function(css, opts) {
var cssprocess = function(css) {
//保存当前处理文件路径
currentFilePath = path.dirname(opts.from);
css.eachRule(cssgraceRule);
currentFilePath = getCurrentFilePath(css) || currentFilePath;
css.walkRules(cssgraceRule);
}

@@ -539,3 +544,2 @@

currentFilePath = path.dirname(opts.from);
console.log(currentFilePath);
return postcss(cssprocess).process(css, opts).css;

@@ -542,0 +546,0 @@ }

{
"name": "cssgrace",
"version": "2.0.2",
"version": "3.0.0",
"description": "CSS postproccessor",

@@ -26,9 +26,6 @@ "main": "lib/index.js",

"dependencies": {
"postcss": "^5.0.11",
"image-size": "^0.3.5"
},
"peerDependencies": {
"postcss": "^4.0.0"
},
"devDependencies": {
"postcss": "^4.0.0",
"tape": "^3.0.0"

@@ -35,0 +32,0 @@ },

@@ -5,2 +5,3 @@

[![Build Status](https://travis-ci.org/cssdream/cssgrace.svg?branch=master)](https://travis-ci.org/cssdream/cssgrace)
[![Build status](https://ci.appveyor.com/api/projects/status/github/cssdream/cssgrace?branch=master&svg=true)](https://ci.appveyor.com/project/yisibl/cssgrace/branch/master)
[![NPM Downloads](https://img.shields.io/npm/dm/cssgrace.svg?style=flat)](https://www.npmjs.com/package/cssgrace)

@@ -7,0 +8,0 @@ [![NPM Version](http://img.shields.io/npm/v/cssgrace.svg?style=flat)](https://www.npmjs.com/package/cssgrace)

@@ -5,2 +5,3 @@

[![Build Status](https://travis-ci.org/cssdream/cssgrace.svg?branch=master)](https://travis-ci.org/cssdream/cssgrace)
[![Build status](https://ci.appveyor.com/api/projects/status/github/cssdream/cssgrace?branch=master&svg=true)](https://ci.appveyor.com/project/yisibl/cssgrace/branch/master)
[![NPM Downloads](https://img.shields.io/npm/dm/cssgrace.svg?style=flat)](https://www.npmjs.com/package/cssgrace)

@@ -7,0 +8,0 @@ [![NPM Version](http://img.shields.io/npm/v/cssgrace.svg?style=flat)](https://www.npmjs.com/package/cssgrace)

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