@@ -4,6 +4,7 @@ const path = require('path')
4
4
const postcss = require ( 'postcss' )
5
5
const diff = require ( 'diff' )
6
6
const maxmin = require ( 'maxmin' )
7
+ const picocolors = require ( 'picocolors' )
7
8
8
9
module . exports = ( grunt ) => {
9
10
let options
@@ -149,7 +150,7 @@ module.exports = (grunt) => {
149
150
for ( const f of this . files ) {
150
151
const src = f . src . filter ( ( filepath ) => {
151
152
if ( ! grunt . file . exists ( filepath ) ) {
152
- grunt . log . error ( ' Source file \x1b[33m%s\x1b[0m not found.' , filepath )
153
+ grunt . log . error ( ` Source file ${ picocolors . cyan ( filepath ) } not found.` )
153
154
154
155
return false
155
156
}
@@ -158,7 +159,7 @@ module.exports = (grunt) => {
158
159
} )
159
160
160
161
if ( src . length === 0 ) {
161
- grunt . log . error ( '\x1b[31mNo source files were found.\x1b[0m' )
162
+ grunt . log . error ( picocolors . red ( 'No source files were found.' ) )
162
163
163
164
done ( )
164
165
continue
@@ -175,13 +176,13 @@ module.exports = (grunt) => {
175
176
tally . issues += warnings . length
176
177
177
178
for ( const msg of warnings ) {
178
- grunt . log . error ( '\x1b[31m%s\x1b[0m' , msg . toString ( ) )
179
+ grunt . log . error ( picocolors . red ( msg . toString ( ) ) )
179
180
}
180
181
181
182
if ( options . writeDest ) {
182
183
tally . sizeAfter += result . css . length
183
184
grunt . file . write ( dest , result . css )
184
- grunt . log . ok ( ' File \x1b[36m%s\x1b[0m created. \x1b[36m%s\x1b[0m' , dest , maxmin ( input . length , result . css . length ) )
185
+ grunt . log . ok ( ` File ${ picocolors . cyan ( dest ) } created. ${ picocolors . green ( maxmin ( input . length , result . css . length ) ) } ` )
185
186
}
186
187
187
188
tally . sheets += 1
@@ -194,7 +195,7 @@ module.exports = (grunt) => {
194
195
}
195
196
196
197
grunt . file . write ( mapDest , result . map . toString ( ) )
197
- grunt . log . ok ( ' File \x1b[36m%s\x1b[0m created (source map).' , ` ${ dest } .map `)
198
+ grunt . log . ok ( ` File ${ picocolors . cyan ( ` ${ dest } .map` ) } created (source map).`)
198
199
199
200
tally . maps += 1
200
201
}
@@ -203,7 +204,7 @@ module.exports = (grunt) => {
203
204
const diffPath = typeof options . diff === 'string' ? options . diff : `${ dest } .diff`
204
205
205
206
grunt . file . write ( diffPath , diff . createPatch ( dest , input , result . css ) )
206
- grunt . log . ok ( ' File \x1b[36m%s\x1b[0m created (diff).' , diffPath )
207
+ grunt . log . ok ( ` File ${ picocolors . cyan ( diffPath ) } created (diff).` )
207
208
208
209
tally . diffs += 1
209
210
}
@@ -215,7 +216,7 @@ module.exports = (grunt) => {
215
216
if ( tally . sheets ) {
216
217
if ( options . writeDest ) {
217
218
const size = maxmin ( tally . sizeBefore , tally . sizeAfter )
218
- grunt . log . ok ( `${ tally . sheets } processed ${ grunt . util . pluralize ( tally . sheets , 'stylesheet/stylesheets' ) } created. \x1b[36m%s\x1b[0m` , size )
219
+ grunt . log . ok ( `${ tally . sheets } processed ${ grunt . util . pluralize ( tally . sheets , 'stylesheet/stylesheets' ) } created. ${ picocolors . green ( size ) } ` )
219
220
} else {
220
221
grunt . log . write ( `${ tally . sheets } ${ grunt . util . pluralize ( tally . sheets , 'stylesheet/stylesheets' ) } processed, no files written.` )
221
222
}
0 commit comments