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

auto add path namespace for every component

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
1
Weekly downloads
 
Created
Source

css-path-loader

React 组件 css 命名空间生成器

注: 此插件需要 less 或者 scss 作为 css 预编译器 此插件需要和 [html-path-loader] 配合使用才能发挥作用

Usage

假设一个 react 组件在项目的路径为 src/components/test/index.js index.js的相同目录下还有个 index.scss

// 在 index.js
require('./index.scss') // less 或者 scss

// webpack.config
         
{
    test: /\.(scss|less)/,
    exclude: /node_modules/,
    loaders: ['style', 'css', 'autoprefixer', 'sass', 'less', 'css-path-loader']
}


index.scss 里面的代码都会自动根据当前文件的父级文件夹路径生成一个唯一的命名空间(前提是保证一个文件夹一个组件) 会自动生成 .src-component-test { // code from index.scss }

从而保证该组件所在文件夹内部引入的 css 代码都在其相应的命名空间内

Keywords

FAQs

Package last updated on 26 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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