New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

css-path-loader

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-path-loader - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

15

index.js

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

var path = require('path')
module.exports = function (source, map) {

@@ -7,3 +9,16 @@ this.cacheable && this.cacheable()

this.callback(null, source, map)
return false
}
// 找到入口文件绝对位置
if (Object.prototype.toString.call(this.options.entry) === '[object Array]') {
for (var value of this.options.entry) {
if (/[a-zA-Z-\.\/]+(js|jsx)$/.test(value)) {
var entryPath = path.resolve(this.options.context + '/' + value)
if (entryPath.replace(/\.(js|jsx)/, '') === this.resourcePath.replace(/\.(less|scss)/, '')) {
this.callback(null, source, map)
return false;
}
}
}
}

@@ -10,0 +25,0 @@

2

package.json
{
"name": "css-path-loader",
"version": "0.2.2",
"version": "0.2.3",
"description": "auto add path namespace for every component",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,4 +11,2 @@ css-path-loader

如果项目中有通用样式文件, 请使用 `@import` 来引入而不是在 `js` 使用 `require`
如果样式和组件是`完全分开`放置请不要使用这个 loader,

@@ -52,1 +50,5 @@

+ 如果在 `scss` 或者 `less` 文件中通过 `@import` 引入 `node_modules` 里或者其他地方的 `scss` 或者 `less` 文件, 都只会作用于当前组件, 所有的样式的作用域也都属于当前组件
+ 如果项目中有通用样式文件, 请在 webpack 配置 entry 文件中使用 require 引入或者在其他文件中使用 `@import` 来引入而不是在某个模块的js文件中使用 `require`
+ 如果项目中需要通用样式文件, 推荐在每一个组件的样式文件中通过@import 引入(支持编辑器提示)
+ 引入全局样式文件只需在 webpack.js 中定义的 entry 文件中通过 require 引入即可
+ 除了 webpack 定义的 entry 文件, 其他 js|jsx 文件都不要用 require 加载*非当前目录*下的 scss|less 文件!!
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