This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/postcss/lib/result.js
2020-11-01 22:46:04 +00:00

42 lines
726 B
JavaScript

'use strict'
let Warning = require('./warning')
class Result {
constructor (processor, root, opts) {
this.processor = processor
this.messages = []
this.root = root
this.opts = opts
this.css = undefined
this.map = undefined
}
toString () {
return this.css
}
warn (text, opts = {}) {
if (!opts.plugin) {
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
opts.plugin = this.lastPlugin.postcssPlugin
}
}
let warning = new Warning(text, opts)
this.messages.push(warning)
return warning
}
warnings () {
return this.messages.filter(i => i.type === 'warning')
}
get content () {
return this.css
}
}
module.exports = Result