Socket
Socket
Sign inDemoInstall

postcss-load-plugins

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-load-plugins - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

CHANGELOG.md

35

index.js
// ------------------------------------
// #POSTCSS - LOAD PLUGINS - INDEX
// # POSTCSS - LOAD PLUGINS - INDEX
// ------------------------------------

@@ -15,8 +15,9 @@

/**
* Autoload Plugins for PostCSS
*
* @author Michael Ciniawsky (@michael-ciniawsky) <michael.ciniawsky@gmail.com>
* @description Autoload Plugins for PostCSS
* @license MIT
*
* @module postcss-load-plugins
* @version 1.0.0
* @version 2.2.0
*

@@ -42,5 +43,3 @@ * @requires cosmiconfig

if (ctx.env === undefined) {
process.env.NODE_ENV = 'development'
}
if (!ctx.env) process.env.NODE_ENV = 'development'

@@ -52,5 +51,3 @@ var file

.then(function (result) {
if (result === undefined) {
console.log('PostCSS Plugins could not be loaded.' + path)
}
if (!result) throw new Error('No PostCSS Config found in: ' + path)

@@ -62,21 +59,9 @@ file = result ? result.filepath : ''

.then(function (plugins) {
if (typeof plugins === 'function') {
plugins = plugins(ctx)
}
if (typeof result === 'object') {
plugins = assign(plugins, ctx)
}
if (typeof plugins === 'function') plugins = plugins(ctx)
else plugins = assign(plugins, ctx)
if (!plugins.plugins) {
plugins.plugins = []
}
if (!plugins.plugins) plugins.plugins = []
return {
plugins: loadPlugins(plugins),
file: file
}
return { plugins: loadPlugins(plugins), file: file }
})
.catch(function (err) {
console.log(err)
})
}
// ------------------------------------
// #POSTCSS - LOAD PLUGINS - PLUGINS
// # POSTCSS - LOAD PLUGINS - PLUGINS
// ------------------------------------

@@ -18,26 +18,12 @@

if (Array.isArray(config.plugins)) {
plugins = config.plugins
plugins = config.plugins.filter(Boolean)
plugins = plugins.filter(Boolean)
if (plugins.length && plugins.length > 0) {
plugins.forEach(function (plugin) {
if (!plugin) {
var error = new Error(
'Loading PostCSS Plugin failed. Please check your PostCSS Config'
)
plugins.forEach(function (plugin, i) {
if (!plugin) throw new Error('Loading PostCSS Plugin failed')
console.log(error.message)
if (plugin.postcss) plugin = plugin.postcss
return
}
if (plugin.default) plugin = plugin.default
if (plugin.postcss) {
plugin = plugin.postcss
}
if (plugin.default) {
plugin = plugin.default
}
if (

@@ -47,5 +33,3 @@ !(typeof plugin === 'object' && Array.isArray(plugin.plugins) ||

) {
throw new TypeError(
'Invalid PostCSS Plugin found. Please check your PostCSS Config'
)
throw new TypeError('Invalid PostCSS Plugin found: ' + '[' + i + ']')
}

@@ -64,3 +48,5 @@ })

} catch (err) {
console.log(err.message)
err.message = 'Loading PostCSS Plugin failed: ' + err.message
throw err
}

@@ -71,3 +57,5 @@ } else {

} catch (err) {
console.log(err.message)
err.message = 'Loading PostCSS Plugin failed: ' + err.message
throw err
}

@@ -81,23 +69,9 @@ }

})
.forEach(function (plugin) {
.forEach(function (plugin, i) {
plugin = load(plugin, config[plugin])
if (!plugin) {
var error = new Error(
'Loading PostCSS Plugin failed. Please check your PostCSS Config'
)
if (plugin.postcss) plugin = plugin.postcss
console.log(error.message)
if (plugin.default) plugin = plugin.default
return
}
if (plugin.postcss) {
plugin = plugin.postcss
}
if (plugin.default) {
plugin = plugin.default
}
if (

@@ -107,9 +81,3 @@ !(typeof plugin === 'object' && Array.isArray(plugin.plugins) ||

) {
var err = new TypeError(
'Invalid PostCSS Plugin found. Please check your PostCSS Config'
)
console.log(err.message)
return
throw new TypeError('Invalid PostCSS Plugin found: ' + '[' + i + ']')
}

@@ -116,0 +84,0 @@

{
"name": "postcss-load-plugins",
"version": "2.1.0",
"version": "2.2.0",
"description": "Autoload Plugins for PostCSS",
"engines": { "node": ">=0.12", "npm": ">=3" },
"engines": { "node": ">=0.12" },
"main": "index.js",
"scripts": {
"lint": "standard",
"test": "nyc ava test/err/index.js test/rc/index.js test/pkg/index.js test/js/**/index.js",
"logs": "standard-changelog > CHANGELOG.md",
"test": "nyc ava -v test/err/index.js test/rc/index.js test/pkg/index.js test/js/**/index.js",
"logs": "standard-changelog -i CHANGELOG.md -w",
"docs": "jsdoc2md index.js lib/plugins.js > INDEX.md",

@@ -22,11 +22,11 @@ "clean": "rm -rf .nyc_output coverage jsdoc-api dmd",

"coveralls": "^2.11.15",
"cssnano": "^3.8.1",
"cssnano": "^3.10.0",
"jsdoc-to-markdown": "^2.0.0",
"nyc": "^9.0.1",
"nyc": "^10.0.0",
"peter": "^1.0.2",
"postcss": "^5.2.6",
"postcss": "^5.2.8",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^9.0.0",
"postcss-nested": "^1.0.0",
"postcss-sprites": "^4.0.0",
"postcss-sprites": "^4.1.1",
"standard": "^8.6.0",

@@ -36,10 +36,2 @@ "standard-changelog": "0.0.1",

},
"ava": {
"verbose": "true"
},
"nyc": {
"all": true,
"include": ["index.js", "lib"],
"extension": [".js"]
},
"files": [

@@ -69,3 +61,3 @@ "lib",

"type": "git",
"url": "git+https://github.com/michael-ciniawsky/postcss-load-plugins.git"
"url": "https://github.com/michael-ciniawsky/postcss-load-plugins.git"
},

@@ -72,0 +64,0 @@ "bugs": {

@@ -15,3 +15,2 @@ [![npm][npm]][npm-url]

<h1>Load Plugins</h1>
<p>Autoload Plugins for PostCSS<p>
</div>

@@ -94,9 +93,7 @@

```js
module.exports = (ctx) => {
return {
plugins: {
'postcss-plugin': ctx.plugin
}
module.exports = (ctx) => ({
plugins: {
'postcss-plugin': ctx.plugin
}
}
})
```

@@ -107,9 +104,7 @@

```js
module.exports = (ctx) => {
return {
plugins: [
require('postcss-plugin')(ctx.plugin)
]
}
}
module.exports = (ctx) => ({
plugins: [
require('postcss-plugin')(ctx.plugin)
]
})
```

@@ -164,11 +159,9 @@

```js
module.exports = (ctx) => {
return {
plugins: {
postcss-import: {},
postcss-modules: ctx.modules ? {} : false,
cssnano: ctx.env === 'production' ? {} : false
}
module.exports = (ctx) => ({
plugins: {
postcss-import: {},
postcss-modules: ctx.modules ? {} : false,
cssnano: ctx.env === 'production' ? {} : false
}
}
})
```

@@ -191,3 +184,3 @@

.process(css)
.then(({ css }) => console.log(css))
.then((result) => console.log(result.css))
})

@@ -194,0 +187,0 @@ ```

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