Skip to content

Fix: multiple <include> tag with global locals evaluate locals uncorrectry #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 6, 2022

Conversation

nokazn
Copy link
Contributor

@nokazn nokazn commented Mar 23, 2022

Overview

Hi, there!

I run into a case that using <include> tag multiple times with locals defined globally causes uncorrect evaluation for locals. This PR is a patch for that case.

Example

<!-- parts.html -->
<div>{{ foo }}</div>
<include src="parts.html" locals='{ "foo": 1 }'></include>
<include src="parts.html" locals='{ "foo": 2 }'></include>

<!-- expected -->
<div>1</div>
<div>2</div>
<!-- actual -->
<div>1</div>
<div>1</div>

(See also test/expected/multiple-include.html.)

Points to change

  • fix merged locals options for posthtml-expressions & add test cases
  • fix xo error for missing extension (../lib../lib/index.js)

issues

fix #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Locals overwritten when using posthtmlExpressionsOptions
2 participants