11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.76k stars 484 forks source link

Output file not changing after layout change #2822

Closed brettdewoody closed 1 year ago

brettdewoody commented 1 year ago

Operating system

macOS Catalina 10.15.7

Eleventy

2.0.0

Describe the bug

I'm trying to output a .mjml file, then convert to html using mjml. I've attempted this 2 very different ways with the same unexpected output.

  1. Using the mjml CLI In this setup I used a .njk layout to generate an email.mjml file. Then run mjml through a node script on the output file to generate an .html file.

  2. Using an 11ty transform with m2ml2html In this setup I added an 11ty transform that operates on .mjml files and converts them to HTML.

In both setups, when I start 11ty it correctly builds the HTML file by parsing the MJML. But on subsequent changes to the layout, 11ty detects the file change, shows it rebuilds the file, but the output is the same as before. As if the layout was cached. All changes result in the same original output.

Changes to other layout work as expected, with the page updating as expected.

My transform is:

const mjml2html = require('mjml')

eleventyConfig.addTransform("mjml", function(content) {
    // Convert MJML templates to HTML
    if ( this.page.outputPath && this.page.outputPath.endsWith(".mjml") ) {
      let { html } = mjml2html(content);
      return html;
    }

    return content;
  });

The mjml template is valid mjml. Something like:

<mjml>
   ... rest of mjml
</mjml>

Reproduction steps

No response

Expected behavior

The updated layout should be used when rebuilding the page.

Reproduction URL

No response

Screenshots

No response

brettdewoody commented 1 year ago

Oddly, even when I changed the contents and format to something other than mjml it did not work (even though all other layouts worked fine). I eventually changed the permalink to something entirely different and it started working as expected.

brettdewoody commented 1 year ago

Closing this since it seems to be working.