critters icon indicating copy to clipboard operation
critters copied to clipboard

Critters is commenting out any php in the file

Open CathyMacars opened this issue 6 years ago • 3 comments

Critters succeeds in inlining the css and preloading the link tag, but it also comments out any other php lines on the file, both in the head and body of the document.

I am using Critters with html-webpack-plugin and mini-css-extract-plugin in an mpa.

Here's a relevant chunk of my config:

module.exports = {
        module: {
		rules: [
			{
				test: /\.scss$/,
				use: [
					MiniCssExtractPlugin.loader,
					"css-loader",
					"sass-loader"
				]
			}
		]
	},
	plugins: [
                new HtmlWebpackPlugin({
			chunks: ['common', 'index'],
			filename: 'index.php',
			template: './src/pages/_index.php'
		}),
		new Critters(),
	]
};

CathyMacars avatar Sep 26 '18 16:09 CathyMacars

@CathyMacars

I'm hitting a similar issue, perhaps. Are you running a vanilla PHP website? I'm trying to integrate critters with a Wordpress them and I'm running into trouble: https://github.com/GoogleChromeLabs/critters/issues/16

jcklpe avatar Oct 27 '18 19:10 jcklpe

@jcklpe

Yep... vanilla PHP.

CathyMacars avatar Oct 29 '18 14:10 CathyMacars

Doing the same here, turning something like this:

<?php if ($something === true): ?>

into this:

<!--?php if ($something === true): ?-->

jaydiablo avatar Jul 08 '19 16:07 jaydiablo