Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

Allow to configure juice.codeBlocks #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ passed into `grunt.initConfig()`.
grunt.initConfig({
inlinecss: {
main: {
codeBlocks: {
},
options: {
},
files: {
Expand All @@ -49,6 +51,9 @@ grunt.initConfig({
You can see available options
[here](https://github.com/Automattic/juice/tree/v4.1.0#options)

You can see how to use `codeBlocks`
[here](https://github.com/Automattic/juice/tree/v4.1.0#juicecodeblocks)

## The "inlinecontent" task

### Overview
Expand Down
3 changes: 3 additions & 0 deletions tasks/inline_css.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ module.exports = function(grunt) {
grunt.registerMultiTask('inlinecss', 'Takes an html file with linked css files or separate css files and turns inline. Great for emails.', function() {
// Merge task-specific and/or target-specific options with these defaults.
const options = this.options();
const codeBlocks = this.data.codeBlocks;
const done = this.async();
let index = 0;
const count = this.files.length;

juice.codeBlocks = Object.assign({}, juice.codeBlocks, codeBlocks);

const increaseCount = function () {
index++;
if (index === count) {
Expand Down