How to use the juice.juiceFile function in juice

To help you get started, we’ve selected a few juice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jgallen23 / grunt-inline-css / tasks / inline_css.js View on Github external
const filepath = f.src.toString();
      if (typeof filepath !== 'string' || filepath === '') {
        grunt.log.error('src must be a single string');
        increaseCount();
        return false;
      }

      if (!grunt.file.exists(filepath)) {
        grunt.log.error(`Source file "${filepath}" not found.`);
        increaseCount();
        return false;
      }

      grunt.log.writeln("filepath:", filepath);

      juice.juiceFile(filepath, options, function(err, html) {

        if (err) {
          grunt.log.error(err);
          increaseCount();

          return;
        }

        grunt.file.write(f.dest, html);
        grunt.log.writeln(`File "${f.dest}" created.`);

        increaseCount();
      });
    });
  });
github disintegrator / grunt-juice-email / tasks / juice.js View on Github external
jobs.push(function(callback) {
              juice.juiceFile(filepath, options, function(err, html) {
                if (err) {
                  callback(err);
                  grunt.warn(err, 3);
                }
                else {
                  grunt.file.write(f.dest, html);
                  grunt.log.writeln('File "' + f.dest + '" created.');
                  callback();
                }
              });
            });
          });