Skip to content

Commit

Permalink
Merge bee5368 into c96e085
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Aug 10, 2021
2 parents c96e085 + bee5368 commit f6460b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/locals.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const vm = require('vm')
const matchHelper = require('posthtml-match-helper')
const { render } = require('posthtml-render')
const { match } = require('posthtml/lib/api')

// const code = 'module.exports = {a: 1}';
const ctx = vm.createContext({ module })
Expand All @@ -22,7 +23,7 @@ function scriptDataLocals (tree, options) {
const locals = {}
const localsAttr = options.localsAttr || 'locals'

tree.match(matchHelper(`script[${localsAttr}]`), node => {
match.call(tree, matchHelper(`script[${localsAttr}]`), node => {
if (node.content) {
const code = render(node.content)

Expand Down

0 comments on commit f6460b3

Please sign in to comment.