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

sass-resources-loader

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass-resources-loader

SASS resources loader for Webpack

  • 2.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
205K
decreased by-11.1%
Maintainers
3
Weekly downloads
 
Created

What is sass-resources-loader?

The sass-resources-loader npm package is a Webpack loader that allows you to inject shared Sass resources (such as variables, mixins, and functions) into every Sass file in your project without needing to manually import them in each file. This can help maintain consistency and reduce redundancy in your stylesheets.

What are sass-resources-loader's main functionalities?

Injecting Global Sass Resources

This feature allows you to inject global Sass resources into every Sass file in your project. By specifying the path to your resources file in the `resources` option, you ensure that variables, mixins, and functions defined in that file are available in all your Sass files without needing to import them manually.

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          'style-loader',
          'css-loader',
          'sass-loader',
          {
            loader: 'sass-resources-loader',
            options: {
              resources: './path/to/resources.scss'
            }
          }
        ]
      }
    ]
  }
};

Multiple Resource Files

This feature allows you to specify multiple resource files to be injected into every Sass file. By providing an array of file paths in the `resources` option, you can include multiple sets of variables, mixins, and functions, making them globally available throughout your project.

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          'style-loader',
          'css-loader',
          'sass-loader',
          {
            loader: 'sass-resources-loader',
            options: {
              resources: [
                './path/to/variables.scss',
                './path/to/mixins.scss'
              ]
            }
          }
        ]
      }
    ]
  }
};

Using with Different Loaders

This feature demonstrates how to use sass-resources-loader in conjunction with other loaders like `postcss-loader`. This allows you to integrate global Sass resources while still taking advantage of other CSS processing tools in your Webpack configuration.

module.exports = {
  module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          'style-loader',
          'css-loader',
          'postcss-loader',
          'sass-loader',
          {
            loader: 'sass-resources-loader',
            options: {
              resources: './path/to/resources.scss'
            }
          }
        ]
      }
    ]
  }
};

Other packages similar to sass-resources-loader

Keywords

FAQs

Package last updated on 15 Apr 2022

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