Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Sass like @warn for PostCSS. Disabling internal usage of "postcss-reporter".
// https://github.com/ben-eb/postcss-at-warn
warn({
silent: true
}),
// Parse CSS and add vendor prefixes to rules by Can I Use
// https://github.com/postcss/autoprefixer
autoprefixer(),
// Adding the best CSS compressor to the chain
csso(),
// Log PostCSS messages to the console
reporter({
clearReportedMessages: true
})
]
}
// https://www.npmjs.com/package/postcss-normalize
postcssNormalize(),
// https://www.npmjs.com/package/postcss-will-change
...(tool.postCss.disableGpuHack ? [] : [postcssWillChange()]),
// https://www.npmjs.com/package/postcss-brand-colors
brandColor(),
// https://www.npmjs.com/package/postcss-nippon-color
nipponColor(),
// https://www.npmjs.com/package/postcss-google-color
googleColor(),
// https://github.com/postcss/autoprefixer
autoprefixer({
...tool.postCss.autoprefixer,
browsers: tool.browserslist,
}),
postCssReporter(tool.postCss.reporter),
...tool.postCss.plugins,
],
sourceMap: !isProductionEnv,
}),
calc({
preserve: false
}),
cssnano(),
];
// Skip minifying files if we aren't building for
// production and debug is enabled
if( config.dev.debug.styles && ! isProd ) {
postcssPlugins.pop();
}
// Report messages from other postcss plugins
postcssPlugins.push(
reporter({ clearReportedMessages: true })
);
// Return a single stream containing all the
// after replacement functionality
return pipeline.obj([
gulpPlugins.postcss([
AtImport({
path: [paths.styles.srcDir],
plugins: [
stylelint(),
]
})
]),
gulpPlugins.postcss(postcssPlugins),
gulpPlugins.if(
config.dev.debug.styles,
}),
calc({
preserve: false
}),
cssnano(),
];
// Skip minifying files if we aren't building for
// production and debug is enabled
if( config.dev.debug.styles && ! isProd ) {
postcssPlugins.pop();
}
// Report messages from other postcss plugins
postcssPlugins.push(
reporter({ clearReportedMessages: true })
);
// Return a single stream containing all the
// after replacement functionality
return pipeline.obj([
gulpPlugins.postcss([
AtImport({
path: [paths.styles.srcDir],
plugins: [
stylelint(),
]
})
]),
gulpPlugins.postcss(postcssPlugins),
gulpPlugins.if(
config.dev.debug.styles,
const cleanedMessages = orderedMessages.map(message => {
const location = utils.getLocation(message);
const severity = message.severity;
const row = [
location.line || "",
location.column || "",
symbols[severity]
? chalk[levelColors[severity]](symbols[severity])
: severity,
message.text
// Remove all control characters (newline, tab and etc)
.replace(/[\x01-\x1A]+/g, " ") // eslint-disable-line no-control-regex
.replace(/\.$/, "")
.replace(
new RegExp(_.escapeRegExp("(" + message.rule + ")") + "$"),
""
),
chalk.dim(message.rule || "")
export default function linter() {
return gulp.src('./src/less/**/*.less')
.pipe($.postcss(
[
stylelint(),
reporter({ clearMessages: true }),
],
{
syntax: less,
},
))
.pipe($.duration('linting styles'));
}
return function stylelint() {
return gulp.src(src)
.pipe(postcss([
stylelintPlugin(),
reporter({
clearReportedMessages: true,
}),
], {
syntax: scssSyntax,
}));
};
}
const message = getMessage(proc.postcssPlugin, completed, precise);
res.messages.push(message);
summaryResults = updateSummary(summaryResults, message, {precise, silent});
resolve();
}
});
};
wrappedPlugin.postcssPlugin = proc.postcssPlugin;
wrappedPlugin.postcssVersion = proc.postcssVersion;
return wrappedPlugin;
});
if (!silent) {
result.processor.use(reporter({formatter: formatter}));
}
};
const sourceGroupedMessages = messagesToLog.reduce((result, message) => {
const key = util.getLocation(message).file || resultSource;
if (!message.severity) {
message.severity = message.type || "warning";
}
if (hasOwnProperty.call(result, key)) {
result[key].push(message);
} else {
result[key] = [message];
}
return result;
}, {});