Socket
Socket
Sign inDemoInstall

postcss-sass-loader

Package Overview
Dependencies
71
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-sass-loader

PostCSS Loader Loader for webpack to process SASS with PostCSS


Version published
Weekly downloads
960
decreased by-6.43%
Maintainers
1
Install size
9.08 MB
Created
Weekly downloads
 

Changelog

Source

1.1.0

  • Compile sass by @csstools/postcss-sass (base on dart sass).

Readme

Source

PostCSS Loader

Loader for webpack to process SASS with PostCSS

Install

npm i -D postcss-sass-loader

Usage

Configuration

postcss.config.js

module.exports = {
  plugins: [
      require('autoprefixer')
  ]
}

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.s[ca]ss$/,
        use: [ 'style-loader', 'css-loader', 'postcss-sass-loader' ]
      }
    ]
  }
}

webpack.config.js (recommended)

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          'style-loader',
          { loader: 'css-loader', options: { alias: { "@test": "/home/test"} } },
          'postcss-sass-loader'
        ]
      }
    ]
  }
}

Options

NameTypeDefaultDescription
config{Object}undefinedSet postcss.config.js config path && ctx
plugins{Array|Function}[]Set PostCSS Plugins
sourceMap{String|Boolean}falseEnable Source Maps
alias{Object}undefinedSet import alias

Plugins

webpack.config.js

{
  loader: 'postcss-sass-loader',
  options: {
    ident: 'postcss',
    plugins: (loader) => [
      require('postcss-import')({ root: loader.resourcePath }),
      require('postcss-preset-env')(),
      require('cssnano')()
    ]
  }
}

alias

webpack.config.js

{
  test: /\.s[ca]ss$/,
  use: [
    'style-loader',
    'css-loader',
    {
      loader: 'postcss-sass-loader',
      options: {
        alias: {
            "@test": "/home/test"
        }
      }
    }
  ]
}

⚠️ webpack requires an identifier (ident) in options when {Function}/require is used (Complex Options). The ident can be freely named as long as it is unique. It's recommended to name it (ident: 'postcss')

Examples

Autoprefixing

webpack.config.js

{
  test: /\.s[ca]ss$/,
  use: [
    'style-loader',
    'css-loader',
    {
      loader: 'postcss-sass-loader',
      options: {
        plugins: [
          require('autoprefixer')({...options}),
          ...,
        ]
      }
    }
  ]
}

Keywords

FAQs

Last updated on 03 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc