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

blendid

Package Overview
Dependencies
Maintainers
7
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blendid - npm Package Compare versions

Comparing version 4.5.0 to 4.5.1

gulpfile.js/lib/addPostCssPlugin.js

68

CHANGELOG.md
# Changelog
## 4.5.1
- Adds PostCSS support
- Autoprefixer replaces gulp-autoprefixer
- cssnano replaces gulp-cssnano
Users can configure `plugins` and `options` in `task-config.js`'s `stylesheets.postcss`. See [gulp-postcss](https://github.com/postcss/gulp-postcss) for more info.
Basic usage is unchanged. Source stylesheets will be preprocessed with Sass unless `stylesheets.sass` is `false`. You can still call out Sass explicitly if you like:
```javascript
// in task-config.js
stylesheets: true
```
A `task-config` with custom PostCSS will look like this
```javascript
// task-config.js
// must also add the dependencies (`(npm i|yarn add) some-plugin some-option`)
var somePlugin = require('some-plugin')
var someOption = require('some-option')
var postCssPlugins = [somePlugin()]
var postCssOptions = {someOption}
module.exports = {
// ...
stylesheets: {
// sass: true is implied
postcss: {
plugins: postCssPlugins,
options: postCssOptions
}
}
// ...
}
```
Autoprefixer and cssnano are injected into the PostCSS plugins list, and do not need to be specified. However custom Autoprefixer and/or cssnano configs are respected if provided. That looks like this:
```javascript
// task-config.js
// must also add the autoprefixer dependency (`(npm i|yarn add) autoprefixer`)
var autoprefixer = require('autoprefixer')
var postCssPlugins = [
autoprefixer({
grid: "autoplace"
})
]
module.exports = {
// ...
stylesheets: {
// sass: true is implied
postcss: {
plugins: postCssPlugins
}
}
// ...
}
```
## 4.5.0

@@ -4,0 +72,0 @@ Recommended security-focused upgrade:

12

gulpfile.js/lib/task-defaults.js

@@ -43,3 +43,13 @@ const os = require('os')

},
extensions: ["sass", "scss", "css"]
extensions: ["sass", "scss", "css", "pcss"],
cssnano: {
// deprecated. configure cssnano in stylesheets.postcss.plugins
},
postcss: {
plugins: [
// Autoprefixer and cssnano are added automatically,
// with default settings, if not given custom configuration here
],
options: {}
}
},

@@ -46,0 +56,0 @@

52

gulpfile.js/tasks/stylesheets.js
if(!TASK_CONFIG.stylesheets) return
var gulp = require('gulp')
var gulpif = require('gulp-if')
var browserSync = require('browser-sync')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')
var handleErrors = require('../lib/handleErrors')
var autoprefixer = require('gulp-autoprefixer')
var projectPath = require('../lib/projectPath')
var cssnano = require('gulp-cssnano')
var gulp = require('gulp')
var addPostCssPlugin = require('../lib/addPostCssPlugin')
var autoprefixer = require('autoprefixer')
var browserSync = require('browser-sync')
var cssnano = require('cssnano')
var gulpif = require('gulp-if')
var handleErrors = require('../lib/handleErrors')
var postcss = require('gulp-postcss')
var projectPath = require('../lib/projectPath')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')

@@ -20,3 +22,3 @@ var sassTask = function () {

if(TASK_CONFIG.stylesheets.sass && TASK_CONFIG.stylesheets.sass.includePaths) {
if (TASK_CONFIG.stylesheets.sass && TASK_CONFIG.stylesheets.sass.includePaths) {
TASK_CONFIG.stylesheets.sass.includePaths = TASK_CONFIG.stylesheets.sass.includePaths.map(function(includePath) {

@@ -27,11 +29,31 @@ return projectPath(includePath)

var cssnanoConfig = TASK_CONFIG.stylesheets.cssnano || {}
cssnanoConfig.autoprefixer = false // this should always be false, since we're autoprefixing separately
TASK_CONFIG.stylesheets.autoprefixer = TASK_CONFIG.stylesheets.autoprefixer || {}
TASK_CONFIG.stylesheets.cssnano = TASK_CONFIG.stylesheets.cssnano || {}
TASK_CONFIG.stylesheets.cssnano.autoprefixer = false // this should always be false, since we're autoprefixing separately
TASK_CONFIG.stylesheets.postcss.options = TASK_CONFIG.stylesheets.postcss.options || {}
TASK_CONFIG.stylesheets.postcss.plugins = TASK_CONFIG.stylesheets.postcss.plugins || []
var preprocess = !!TASK_CONFIG.stylesheets.sass
// when watching files, only run once
if (!TASK_CONFIG.stylesheets.configured) {
// ensure Autoprefixer is in the PostCSS config
addPostCssPlugin('autoprefixer', autoprefixer(TASK_CONFIG.stylesheets.autoprefixer))
if (global.production) {
// ensure cssnano is in the PostCSS config
addPostCssPlugin('cssnano', cssnano(TASK_CONFIG.stylesheets.cssnano))
}
}
TASK_CONFIG.stylesheets.configured = true
return gulp.src(paths.src)
.pipe(gulpif(!global.production, sourcemaps.init()))
.pipe(sass(TASK_CONFIG.stylesheets.sass))
.pipe(gulpif(preprocess, sass(TASK_CONFIG.stylesheets.sass)))
.on('error', handleErrors)
.pipe(autoprefixer(TASK_CONFIG.stylesheets.autoprefixer))
.pipe(gulpif(global.production, cssnano(cssnanoConfig)))
.pipe(postcss(TASK_CONFIG.stylesheets.postcss.plugins, TASK_CONFIG.stylesheets.postcss.options))
.on('error', handleErrors)
.pipe(gulpif(!global.production, sourcemaps.write()))

@@ -38,0 +60,0 @@ .pipe(gulp.dest(paths.dest))

{
"name": "blendid",
"version": "4.5.0",
"version": "4.5.1",
"description": "A full featured configurable asset pipeline and static site builder",

@@ -28,2 +28,3 @@ "license": "MIT",

"ansi-colors": "^3.2.4",
"autoprefixer": "^9.6.0",
"babel-core": "^6.26.3",

@@ -34,2 +35,3 @@ "babel-loader": "^7.1.1",

"browser-sync": "^2.26.3",
"cssnano": "^4.1.10",
"del": "4.0.0",

@@ -39,5 +41,3 @@ "es6-promise": "^4.2.6",

"gulp": "3.9.1",
"gulp-autoprefixer": "6.0.0",
"gulp-changed": "^3.2.0",
"gulp-cssnano": "2.1.3",
"gulp-data": "1.3.1",

@@ -49,3 +49,4 @@ "gulp-gh-pages": "0.5.4",

"gulp-nunjucks-render": "^2.2.2",
"gulp-rename": "1.4.0",
"gulp-postcss": "^8.0.0",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",

@@ -52,0 +53,0 @@ "gulp-rev": "9.0.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