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

postcss-less-loader

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-less-loader

PostCSS Loader Loader for webpack to process LESS with PostCSS

  • 0.1.0-alpha.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

PostCSS Loader

Loader for webpack to process LESS with PostCSS

Install

npm i -D postcss-less-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-less-loader' ]
      }
    ]
  }
}

webpack.config.js (recommended)

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          'style-loader',
          { loader: 'css-loader', options: { alias: { "@test": "/home/test"} } },
          'postcss-less-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-less-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-less-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-less-loader',
      options: {
        plugins: [
          require('autoprefixer')({...options}),
          ...,
        ]
      }
    }
  ]
}

Keywords

FAQs

Package last updated on 17 May 2019

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