changeOrAdded.js 435 B

123456789101112131415
  1. const fs = require('fs');
  2. const log = require('./log');
  3. const compile = require('./compile');
  4. module.exports = (filePath) => {
  5. log(`'${filePath}' is being processed.`);
  6. // Transform the file.
  7. compile(filePath, function write(code) {
  8. const fileName = filePath.slice(0, -9);
  9. // Write the result to the filesystem.
  10. fs.writeFile(`${fileName}.css`, code, () => {
  11. log(`'${filePath}' is finished.`);
  12. });
  13. });
  14. };