Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

more-css

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

more-css - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

2

package.json
{
"name": "more-css",
"version": "0.4.6",
"version": "0.4.7",
"description": "a css pre-compiler & agressive compressor",

@@ -5,0 +5,0 @@ "maintainers": [

@@ -59,7 +59,11 @@ ##A css pre-compiler by javascript

设置相对根路径的根路径,此在build()方法中用到,且不使用相对根路径的情况下无需设置。
设置uri的根路径,此在@import解析中会用到,且不使用相对根路径的情况下无需设置。
more.localRoot(localRoot:String):String
设置本地根路径,此在build()方法中用到,且不使用相对根路径的情况下无需设置。
more.less(l:Boolean):Boolean
是否兼容less的相对路径。在uri标准中,'/uri'为相对根路径,'uri'和'./uri'均为相对当前路径,兼容less为仅后者为当前路径,前2为相对根。此设置会干扰@import和构建。
是否兼容less的相对路径。在uri标准中,'/uri'为相对根路径,'uri'和'./uri'均为相对当前路径,兼容less为仅后者为当前路径,前2为相对根。此设置会干扰@import和build()方法。

@@ -66,0 +70,0 @@ more.suffix(s:String):String

@@ -23,4 +23,3 @@ var CssLexer = require('./lexer/CssLexer'),

exArr,
global,
less;
global;

@@ -120,4 +119,12 @@ function init(ignore) {

if(less) {
s = s.replace(/^(['"]?)([\w-])/, '$1/$2');
if(/^(['"]?)\//.test(s)) {
s = s.replace(/^(['"]?)\//, '$1' + root);
}
else {
s = s.replace(/^(['"]?)([\w-])/, '$1' + root + '$2');
}
}
else {
s = s.replace(/^(['"]?)\//, '$1' + root);
}
}

@@ -374,2 +381,3 @@ res += s;

};
var less;
exports.less = function(l) {

@@ -397,5 +405,14 @@ less = l;

};
var root;
var localRoot = '';
exports.localRoot = function(r) {
if(r) {
localRoot = r;
}
return localRoot;
};
var root = '';
exports.root = function(r) {
if(r) {
if(r.charAt(0) != '/') r = '/' + r;
if(r.lastIndexOf('/') != r.length - 1) r += '/';
root = r;

@@ -465,10 +482,23 @@ }

impts.forEach(function(impt) {
if(impt.charAt(0) == '/') {
if(!root) {
throw new Error('����@import����Ը�·���ļ���Ҫ��������root:\n' + file + ' -> ' + impt);
if(less) {
if(impt.charAt(0) == '.') {
impt = cur + impt.replace(/\w+\/\.\.\\/g, '').replace(/\.\//g, '');
}
impt = root.replace(/[/\\]$/, '') + impt;
else {
if(!localRoot) {
throw new Error('����@import����Ը�·���ļ���Ҫ��������root:\n' + file + ' -> ' + impt);
}
impt = localRoot.replace(/[/\\]$/, '') + '/' + impt.replace(/^[/\\]/, '');
}
}
else {
impt = cur + impt.replace(/\w+\/\.\.\\/g, '').replace(/\.\//g, '');
if(impt.charAt(0) == '/') {
if(!localRoot) {
throw new Error('����@import����Ը�·���ļ���Ҫ��������root:\n' + file + ' -> ' + impt);
}
impt = localRoot.replace(/[/\\]$/, '') + impt;
}
else {
impt = cur + impt.replace(/\w+\/\.\.\\/g, '').replace(/\.\//g, '');
}
}

@@ -475,0 +505,0 @@ var trace = '';

@@ -24,4 +24,3 @@ define(function(require, exports) {

exArr,
global,
less;
global;

@@ -121,4 +120,12 @@ function init(ignore) {

if(less) {
s = s.replace(/^(['"]?)([\w-])/, '$1/$2');
if(/^(['"]?)\//.test(s)) {
s = s.replace(/^(['"]?)\//, '$1' + root);
}
else {
s = s.replace(/^(['"]?)([\w-])/, '$1' + root + '$2');
}
}
else {
s = s.replace(/^(['"]?)\//, '$1' + root);
}
}

@@ -375,2 +382,3 @@ res += s;

};
var less;
exports.less = function(l) {

@@ -398,5 +406,14 @@ less = l;

};
var root;
var localRoot = '';
exports.localRoot = function(r) {
if(r) {
localRoot = r;
}
return localRoot;
};
var root = '';
exports.root = function(r) {
if(r) {
if(r.charAt(0) != '/') r = '/' + r;
if(r.lastIndexOf('/') != r.length - 1) r += '/';
root = r;

@@ -471,6 +488,6 @@ }

else {
if(!root) {
if(!localRoot) {
throw new Error('����@import����Ը�·���ļ���Ҫ��������root:\n' + file + ' -> ' + impt);
}
impt = root.replace(/[/\\]$/, '') + '/' + impt.replace(/^[/\\]/, '');
impt = localRoot.replace(/[/\\]$/, '') + '/' + impt.replace(/^[/\\]/, '');
}

@@ -480,6 +497,6 @@ }

if(impt.charAt(0) == '/') {
if(!root) {
if(!localRoot) {
throw new Error('����@import����Ը�·���ļ���Ҫ��������root:\n' + file + ' -> ' + impt);
}
impt = root.replace(/[/\\]$/, '') + impt;
impt = localRoot.replace(/[/\\]$/, '') + impt;
}

@@ -486,0 +503,0 @@ else {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc