Closed cossssmin closed 3 years ago
https://stackoverflow.com/questions/66264845/inserting-ignored-php-code-within-maizzle-components
As Mark explains in the SO question, currently Components do not use options that you set in your config.js for PostHTML.
config.js
So if you had a component like this:
<!-- src/components/example.html --> Start date in component is: <?php echo $start_date ?>
... and you configure build.posthtml.options to ignore PHP tags:
build.posthtml.options
// config.js module.exports = { build: { posthtml: { options: { directives: [{ name: '?php', start: '<', end: '>' }] } } } }
... using the Component like this:
Start date in template is: <?php echo $start_date ?> <component src="src/components/example.html"></component>
... will currently render:
Start date in template is: <?php echo $start_date ?> Start date in component is:
A possible solution might be for posthtml-modules to accept and use PostHTML options in its processWithPostHtml method.
posthtml-modules
processWithPostHtml
Available in v3.1.6
https://stackoverflow.com/questions/66264845/inserting-ignored-php-code-within-maizzle-components
As Mark explains in the SO question, currently Components do not use options that you set in your
config.js
for PostHTML.So if you had a component like this:
... and you configure
build.posthtml.options
to ignore PHP tags:... using the Component like this:
... will currently render:
A possible solution might be for
posthtml-modules
to accept and use PostHTML options in itsprocessWithPostHtml
method.