@lodder/grunt-postcss
Advanced tools
Comparing version 3.1.0 to 3.1.1
{ | ||
"name": "@lodder/grunt-postcss", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Apply several post-processors to your CSS using PostCSS", | ||
@@ -29,3 +29,4 @@ "author": { | ||
"diff": "^5.0.0", | ||
"maxmin": "^3.0.0" | ||
"maxmin": "^3.0.0", | ||
"picocolors": "^1.0.0" | ||
}, | ||
@@ -40,9 +41,9 @@ "devDependencies": { | ||
"load-grunt-tasks": "^5.1.0", | ||
"postcss": "^8.3.9", | ||
"postcss-scss": "^4.0.1" | ||
"postcss": "^8.3.11", | ||
"postcss-scss": "^4.0.2" | ||
}, | ||
"peerDependencies": { | ||
"grunt": ">=1.0.4", | ||
"postcss": "^8.2.9" | ||
"postcss": "^8.0.0" | ||
} | ||
} |
# grunt-postcss | ||
[![NPM Version](https://img.shields.io/npm/v/@lodder/grunt-postcss.svg)](https://npmjs.org/package/@lodder/grunt-postcss) | ||
[![Build Status](https://github.com/C-Lodder/grunt-postcss/workflows/Tests/badge.svg)](https://github.com/C-Lodder/grunt-postcss/actions?workflow=Tests) | ||
[![dependencies Status](https://img.shields.io/david/C-Lodder/grunt-postcss.svg)](https://david-dm.org/C-Lodder/grunt-postcss) | ||
[![npm Version](https://img.shields.io/npm/v/@lodder/grunt-postcss.svg)](https://npmjs.org/package/@lodder/grunt-postcss) | ||
[![Build Status](https://img.shields.io/github/workflow/status/C-Lodder/grunt-postcss/Tests/master)](https://github.com/C-Lodder/grunt-postcss/actions?query=workflow%3ATests+branch%3Amaster) | ||
@@ -15,3 +14,3 @@ > Apply several post-processors to your CSS using [PostCSS](https://github.com/postcss/postcss). | ||
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
If you haven't used [Grunt](https://gruntjs.com/) before, be sure to check out the [Getting Started](https://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](https://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
@@ -18,0 +17,0 @@ ```shell |
@@ -7,2 +7,3 @@ 'use strict' | ||
const maxmin = require('maxmin') | ||
const picocolors = require('picocolors') | ||
@@ -65,6 +66,6 @@ module.exports = (grunt) => { | ||
prev: getPrevMap(from), | ||
inline: (typeof options.map.inline === 'boolean') ? options.map.inline : true, | ||
inline: typeof options.map.inline === 'boolean' ? options.map.inline : true, | ||
annotation: getAnnotation(to), | ||
sourcesContent: (typeof options.map.sourcesContent === 'boolean') ? options.map.sourcesContent : true, | ||
absolute: (typeof options.map.absolute === 'boolean') ? options.map.absolute : false, | ||
sourcesContent: typeof options.map.sourcesContent === 'boolean' ? options.map.sourcesContent : true, | ||
absolute: typeof options.map.absolute === 'boolean' ? options.map.absolute : false, | ||
} | ||
@@ -126,3 +127,3 @@ | ||
grunt.registerMultiTask('postcss', 'Process CSS files.', function() { | ||
grunt.registerMultiTask('postcss', 'Process CSS files.', function () { | ||
options = this.options({ | ||
@@ -152,6 +153,6 @@ processors: [], | ||
this.files.forEach((f) => { | ||
for (const f of this.files) { | ||
const src = f.src.filter((filepath) => { | ||
if (!grunt.file.exists(filepath)) { | ||
grunt.log.error('Source file \x1b[33m%s\x1b[0m not found.', filepath) | ||
grunt.log.error(`Source file ${picocolors.cyan(filepath)} not found.`) | ||
@@ -165,5 +166,6 @@ return false | ||
if (src.length === 0) { | ||
grunt.log.error('\x1b[31mNo source files were found.\x1b[0m') | ||
grunt.log.error(picocolors.red('No source files were found.')) | ||
return done() | ||
done() | ||
continue | ||
} | ||
@@ -182,3 +184,3 @@ | ||
for (const msg of warnings) { | ||
grunt.log.error('\x1b[31m%s\x1b[0m', msg.toString()) | ||
grunt.log.error(picocolors.red(msg.toString())) | ||
} | ||
@@ -189,3 +191,3 @@ | ||
grunt.file.write(dest, result.css) | ||
grunt.log.ok('>> File \x1b[36m%s\x1b[0m created. \x1b[36m%s\x1b[0m', dest, maxmin(input.length, result.css.length)) | ||
grunt.log.ok(`File ${picocolors.cyan(dest)} created. ${picocolors.green(maxmin(input.length, result.css.length))}`) | ||
} | ||
@@ -203,3 +205,3 @@ | ||
grunt.file.write(mapDest, result.map.toString()) | ||
grunt.log.ok('>> File \x1b[36m%s\x1b[0m created (source map).', `${dest}.map`) | ||
grunt.log.ok(`File ${picocolors.cyan(`${dest}.map`)} created (source map).`) | ||
@@ -213,3 +215,3 @@ tally.maps += 1 | ||
grunt.file.write(diffPath, diff.createPatch(dest, input, result.css)) | ||
grunt.log.ok('>> File \x1b[36m%s\x1b[0m created (diff).', diffPath) | ||
grunt.log.ok(`File ${picocolors.cyan(diffPath)} created (diff).`) | ||
@@ -220,3 +222,3 @@ tally.diffs += 1 | ||
})) | ||
}) | ||
} | ||
@@ -227,3 +229,3 @@ runTasks().then(() => { | ||
const size = maxmin(tally.sizeBefore, tally.sizeAfter) | ||
grunt.log.ok(`${tally.sheets} processed ${grunt.util.pluralize(tally.sheets, 'stylesheet/stylesheets')} created. \x1b[36m%s\x1b[0m`, size) | ||
grunt.log.ok(`${tally.sheets} processed ${grunt.util.pluralize(tally.sheets, 'stylesheet/stylesheets')} created. ${picocolors.green(size)}`) | ||
} else { | ||
@@ -235,7 +237,7 @@ grunt.log.write(`${tally.sheets} ${grunt.util.pluralize(tally.sheets, 'stylesheet/stylesheets')} processed, no files written.`) | ||
if (tally.maps) { | ||
grunt.log.ok(`>> ${tally.maps} ${grunt.util.pluralize(tally.maps, 'sourcemap/sourcemaps')} created.`) | ||
grunt.log.ok(`${tally.maps} ${grunt.util.pluralize(tally.maps, 'sourcemap/sourcemaps')} created.`) | ||
} | ||
if (tally.diffs) { | ||
grunt.log.ok(`>> ${tally.diffs} ${grunt.util.pluralize(tally.diffs, 'diff/diffs')} created.`) | ||
grunt.log.ok(`${tally.diffs} ${grunt.util.pluralize(tally.diffs, 'diff/diffs')} created.`) | ||
} | ||
@@ -242,0 +244,0 @@ |
Sorry, the diff of this file is not supported yet
18770
212
5
195
+ Addedpicocolors@^1.0.0