If the input is the same as the output CSS and the --replace flag is passed, the file is always overridden. Can we somehow prevent this from happening?
The issue I have now is that I have another watcher on these files which detect file changes even if the content is not changed.
|
tasks.push(fs.outputFile(options.to, result.css)) |
|
|
|
if (result.map) { |
|
const mapfile = getMapfile(options) |
|
tasks.push(fs.outputFile(mapfile, result.map)) |
|
} |
We could wrap these lines with a simple check to prevent the file write from happening:
if (result.css !== css.toString('utf8')) {
tasks.push(fs.outputFile(options.to, result.css))
if (result.map) {
const mapfile = getMapfile(options)
tasks.push(fs.outputFile(mapfile, result.map))
}
}
Not sure if we can better add a new option or do this check by default, what do you think?
If the input is the same as the output CSS and the
--replaceflag is passed, the file is always overridden. Can we somehow prevent this from happening?The issue I have now is that I have another watcher on these files which detect file changes even if the content is not changed.
postcss-cli/index.js
Lines 222 to 227 in 42fc85e
We could wrap these lines with a simple check to prevent the file write from happening:
Not sure if we can better add a new option or do this check by default, what do you think?