Comparing version 0.7.4 to 0.7.5
@@ -38,4 +38,4 @@ var homunculus=require('homunculus'); | ||
} | ||
else if(/[\w-]/.test(c)) { | ||
c = /^[\w-]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
else if(/[\w\-\u4e00-\u9fa5]/.test(c)) { | ||
c = /^[\w\-\u4e00-\u9fa5]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
var vara = varHash[c] || globalVar[c]; | ||
@@ -42,0 +42,0 @@ if(vara !== void 0) { |
{ | ||
"name": "more-css", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "a css pre-compiler & agressive compressor", | ||
@@ -39,3 +39,3 @@ "maintainers": [ | ||
"clean-css": "^2.2.16", | ||
"homunculus": "^0.5.7" | ||
"homunculus": "^0.5.9" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
@@ -38,4 +38,4 @@ module homunculus from 'homunculus'; | ||
} | ||
else if(/[\w-]/.test(c)) { | ||
c = /^[\w-]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
else if(/[\w\-\u4e00-\u9fa5]/.test(c)) { | ||
c = /^[\w\-\u4e00-\u9fa5]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
var vara = varHash[c] || globalVar[c]; | ||
@@ -42,0 +42,0 @@ if(vara !== void 0) { |
@@ -160,3 +160,3 @@ var expect = require('expect.js'); | ||
}); | ||
it('confilct', function() { | ||
it('conflict', function() { | ||
var s = '.a{margin:0;padding:0}.b{margin:1}.c{margin:0;padding:0}'; | ||
@@ -205,84 +205,84 @@ expect(More.compress(s, true)).to.eql('.a,.c{padding:0}.a{margin:0}.b{margin:1}.c{margin:0}'); | ||
var s = fs.readFileSync(path.join(__dirname, 'file/960.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/960-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/960-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/960-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/960-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('animate', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/animate.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/animate-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/animate-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/animate-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/animate-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('blueprint', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/blueprint.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/blueprint-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/blueprint-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/blueprint-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/blueprint-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('bootstrap', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/bootstrap.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/bootstrap-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/bootstrap-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/bootstrap-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/bootstrap-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('font-awesome', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/font-awesome.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/font-awesome-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/font-awesome-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/font-awesome-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/font-awesome-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('foundation', function() { | ||
it.only('foundation', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/foundation.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
fs.writeFileSync(path.join(__dirname, 'file/foundation-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/foundation-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/foundation-res1.css'), res1, { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/foundation-res2.css'), res2, { encoding: 'utf-8' }); | ||
}); | ||
it('gumby', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/gumby.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/gumby-res1.css'), res1, { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/gumby-res2.css'), res2, { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/gumby-res1.css'), res1, { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/gumby-res2.css'), res2, { encoding: 'utf-8' }); | ||
}); | ||
it('inuit', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/inuit.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/inuit-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/inuit-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/inuit-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/inuit-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('normalize', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/normalize.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/normalize-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/normalize-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/normalize-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/normalize-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('oocss', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/oocss.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/oocss-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/oocss-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/oocss-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/oocss-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('pure', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/pure.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/pure-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/pure-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/pure-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/pure-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
it('reset', function() { | ||
var s = fs.readFileSync(path.join(__dirname, 'file/reset.css'), { encoding: 'utf-8' }); | ||
var res1 = More.compress(s); | ||
//var res1 = More.compress(s); | ||
var res2 = More.compress(s, true); | ||
fs.writeFileSync(path.join(__dirname, 'file/reset-res1.css'), res1.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
fs.writeFileSync(path.join(__dirname, 'file/reset-res2.css'), res2.replace(/(}+)\n?/g, '$1\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/reset-res1.css'), res1.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
//fs.writeFileSync(path.join(__dirname, 'file/reset-res2.css'), res2.replace(/}/g, '}\n'), { encoding: 'utf-8' }); | ||
}); | ||
}); |
@@ -112,2 +112,8 @@ var expect = require('expect.js'); | ||
}); | ||
it('$中文', function() { | ||
var more = new More(); | ||
var s = '$中文: background:url(xxx);\nbody{$中文}'; | ||
var res = more.parse(s); | ||
expect(res).to.eql('\nbody{background:url(xxx)}'); | ||
}); | ||
it('~ autoSplit', function() { | ||
@@ -114,0 +120,0 @@ var more = new More(); |
@@ -38,4 +38,4 @@ define(function(require, exports, module){var homunculus=require('homunculus'); | ||
} | ||
else if(/[\w-]/.test(c)) { | ||
c = /^[\w-]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
else if(/[\w\-\u4e00-\u9fa5]/.test(c)) { | ||
c = /^[\w\-\u4e00-\u9fa5]+/.exec(s.slice(i + 1))[0] || '$' + c; | ||
var vara = varHash[c] || globalVar[c]; | ||
@@ -42,0 +42,0 @@ if(vara !== void 0) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1353540
105
31568
Updatedhomunculus@^0.5.9