New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stylefmt-loader

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylefmt-loader

Fixes stylelint issues automatically while bundling with Webpack

  • 1.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
decreased by-8.11%
Maintainers
1
Weekly downloads
 
Created
Source

stylefmt-loader

Installation

npm install --save-dev stylefmt stylefmt-loader

or

yarn add --dev stylefmt stylefmt-loader

Short Description

This loader is meant to be used before pre-processing your css. It fixes stylelint issues automatically while bundling with Webpack.

During bundling, this loader will rewrite your css files with the corrections.

Usage

Inline

require("css!postcss!stylefmt!./file.css");
//or
require("css!sass!stylefmt!./file.scss");
//or any other preproccesor

In webpack.config.js

module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          "css-loader",
          "sass-loader",
          "stylefmt-loader"
        ]
      }
    ]
  }

You can also specify your stylelint for stylefmt to use:

module: {
    rules: [
      {
        test: /\.scss$/,
        use: [
          "css-loader",
          "sass-loader",
          {
            loader: "stylefmt-loader",
            options: {
              config: ".stylelintrc"
            }
          }
        ]
      }
    ]
  }

Your css before running webpack

// mixin for clearfix


@mixin      clearfix    ()      { &:before,
&:after {
     content:" ";
     display              : table;  }

&:after        {clear: both;}
}.class
 {
     padding:10px;@include        clearfix();}
.base {  color: red;  }

// placeholder
%base
 {


     padding: 12px
 }

.foo{
@extend      .base;}

.bar
{     @extend            %base;

}

Your css after running webpack

// mixin for clearfix


@mixin clearfix() {
	&:before,
	&:after {
		content: " ";
		display: table;
	}

	&:after {
		clear: both;
	}
}

.class {
	padding: 10px;
	@include clearfix();
}

.base {
	color: red;
}

// placeholder
%base {
	padding: 12px;
}

.foo {
	@extend .base;
}

.bar {
	@extend %base;
}

Want to help?

Please be specific in your issue. The code is not complex, why not proposing a PR?

Running tests

Right now there's only one test and is kind of automated, a cleaner solution would be nice.

$> npm run test

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Keywords

FAQs

Package last updated on 02 Mar 2017

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