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

postcss-mixins

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-mixins - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 2.1
* Add CSS files support for mixins from dir (by Jed Mao).
## 2.0

@@ -2,0 +5,0 @@ * `mixinsDir` loads JSON mixins too (by Jed Mao).

30

index.js

@@ -5,2 +5,3 @@ var postcss = require('postcss');

var globby = require('globby');
var fs = require('fs');

@@ -137,2 +138,7 @@ var stringToAtRule = function (str, obj) {

var requireCss = function (filename) {
var source = fs.readFileSync(filename);
return postcss.parse(source);
};
module.exports = postcss.plugin('postcss-mixins', function (opts) {

@@ -151,3 +157,3 @@ if ( typeof opts === 'undefined' ) opts = { };

globs = opts.mixinsDir.map(function (dir) {
return path.join(dir, '*.{json,js}');
return path.join(dir, '*.{js,json,css}');
});

@@ -159,6 +165,18 @@ }

return function (css, result) {
var discoverMixins = function (atrule) {
if ( atrule.name === 'mixin' ) {
insertMixin(result, mixins, atrule, opts);
} else if ( atrule.name === 'define-mixin' ) {
defineMixin(result, mixins, atrule);
}
};
return globby(globs).then(function (files) {
files.forEach(function (file) {
var name = path.basename(file, path.extname(file));
var ext = path.extname(file);
var name = path.basename(file, ext);
file = path.join(cwd, path.relative(cwd, file));
if (ext === '.css') {
requireCss(file).walkAtRules(discoverMixins);
return;
}
mixins[name] = { mixin: require(file) };

@@ -173,11 +191,5 @@ });

css.walkAtRules(function (rule) {
if ( rule.name === 'mixin' ) {
insertMixin(result, mixins, rule, opts);
} else if ( rule.name === 'define-mixin' ) {
defineMixin(result, mixins, rule);
}
});
css.walkAtRules(discoverMixins);
});
};
});
{
"name": "postcss-mixins",
"version": "2.0.0",
"version": "2.1.0",
"description": "PostCSS plugin for mixins",

@@ -5,0 +5,0 @@ "keywords": [

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