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 8.1.0 to 9.0.0

52

index.js
let { join, basename, extname, relative } = require('path')
let { promisify } = require('util')
let { readFileSync } = require('fs')
let { platform } = require('os')
let { parse } = require('postcss-js')
let sugarss = require('sugarss')
let globby = require('globby')
let vars = require('postcss-simple-vars')
let fs = require('fs')
let glob = require('fast-glob')
let readFile = promisify(fs.readFile)
let MIXINS_GLOB = '*.{js,json,css,sss,pcss}'

@@ -39,27 +36,25 @@ let IS_WIN = platform().includes('win32')

async function loadGlobalMixin(helpers, globs) {
function loadGlobalMixin(helpers, globs) {
let cwd = process.cwd()
let files = await globby(globs, { caseSensitiveMatch: IS_WIN })
let files = glob.sync(globs, { caseSensitiveMatch: IS_WIN })
let mixins = {}
await Promise.all(
files.map(async i => {
let ext = extname(i).toLowerCase()
let name = basename(i, extname(i))
let path = join(cwd, relative(cwd, i))
if (ext === '.css' || ext === '.pcss' || ext === '.sss') {
let content = await readFile(path)
let root
if (ext === '.sss') {
root = sugarss.parse(content, { from: path })
} else {
root = helpers.parse(content, { from: path })
}
root.walkAtRules('define-mixin', atrule => {
addMixin(helpers, mixins, atrule, path)
})
files.forEach(i => {
let ext = extname(i).toLowerCase()
let name = basename(i, extname(i))
let path = join(cwd, relative(cwd, i))
if (ext === '.css' || ext === '.pcss' || ext === '.sss') {
let content = readFileSync(path)
let root
if (ext === '.sss') {
root = sugarss.parse(content, { from: path })
} else {
mixins[name] = { mixin: require(path), file: path }
root = helpers.parse(content, { from: path })
}
})
)
root.walkAtRules('define-mixin', atrule => {
addMixin(helpers, mixins, atrule, path)
})
} else {
mixins[name] = { mixin: require(path), file: path }
}
})
return mixins

@@ -200,5 +195,6 @@ }

if (loadFrom.length > 0) {
return loadGlobalMixin(helpers, loadFrom).then(global => {
try {
let global = loadGlobalMixin(helpers, loadFrom)
addGlobalMixins(helpers, mixins, global, opts.parent)
})
} catch {}
}

@@ -205,0 +201,0 @@ },

{
"name": "postcss-mixins",
"version": "8.1.0",
"version": "9.0.0",
"description": "PostCSS plugin for mixins",

@@ -26,7 +26,7 @@ "keywords": [

"dependencies": {
"globby": "^11.0.3",
"fast-glob": "^3.2.7",
"postcss-js": "^3.0.3",
"postcss-simple-vars": "^6.0.3",
"sugarss": "^3.0.3"
"sugarss": "^4.0.1"
}
}

@@ -171,3 +171,3 @@ # PostCSS Mixins

mixins: {
image: function (mixin, path) {
image: function (mixin, path, dpi) {
return {

@@ -177,3 +177,3 @@ '&': {

},
'@media (min-resolution: 120dpi)': {
['@media (min-resolution: '+ dpi +'dpi)']: {
'&': {

@@ -180,0 +180,0 @@ background: 'url(' + path + '@2x)'

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