css-path-loader
Advanced tools
Comparing version 0.1.2 to 0.1.3
12
index.js
module.exports = function (source, map) { | ||
this.cacheable && this.cacheable() | ||
var namespace = this.resourcePath.replace(/[\W\w]+(?=src\b)/, '').replace(/\.(scss|less)/, '') | ||
var namespace = this.resourcePath.replace(process.cwd() + '/', '').replace(/\.(less|scss)/, '') | ||
var nameArray = namespace.split('/') | ||
nameArray.pop() | ||
namespace = nameArray.join('-') | ||
var filename = this.resourcePath.split('/').pop() | ||
var nameStr = namespace.split('/').join('-') | ||
// 豁免全局样式 | ||
if (namespace !== 'src') { | ||
source = '.' + namespace + '{' + source + '}' | ||
if (nameStr !== filename) { | ||
source = '.' + nameStr + '{' + source + '}' | ||
} | ||
@@ -13,0 +13,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"css-path-loader", | ||
"/private/tmp" | ||
"/private/tmp/test" | ||
] | ||
@@ -30,3 +30,3 @@ ], | ||
"_requiredBy": [ | ||
"#USER" | ||
"/" | ||
], | ||
@@ -36,3 +36,3 @@ "_shasum": "fe629c0f079acbfe90a32eb053b8e3c0a062830a", | ||
"_spec": "css-path-loader", | ||
"_where": "/private/tmp", | ||
"_where": "/private/tmp/test", | ||
"author": { | ||
@@ -76,3 +76,3 @@ "name": "ascoder" | ||
}, | ||
"version": "0.1.2" | ||
"version": "0.1.3" | ||
} |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3102
10
1