grand-parent-loader

1.0.0 • Public • Published

illustration

grand-parent-loader

replace ^& to blockName

npm version

Install

npm i grand-parent-loader

Initialization

module.exports = {
    module: {
        rules: [
            {
                test: /\.scss$/,
                use: [
                    'css-loader', 
                    'sass-loader', //or less-loader               
                	'grand-parent-loader'              
                ]
            },
        ]
    }
}

Example

.select {
  border: 1px solid silver;

  &__item {
    width: 10px;
    background-color: white;
  }
  
  &_dark {
      border: 1px solid red;
      
      ^&__item {
          background-color: black;
      }
                
  }
  
}

^& - will be replaced to grand-parent blockName - .select

result will be

.select {
  border: 1px solid silver;

  &__item {
    width: 10px;
    background-color: white;
  }
  
  &_dark {
      border: 1px solid red;
      
      .select__item {
          background-color: black;
      }
                
  }
  
}

Author

webster6667

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i grand-parent-loader

      Weekly Downloads

      1

      Version

      1.0.0

      License

      MIT

      Unpacked Size

      18.6 kB

      Total Files

      7

      Last publish

      Collaborators

      • webster6667