Skip to content
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

Preserve SSI Comments #6920

Closed
SoftCreatR opened this issue Sep 13, 2021 · 8 comments
Closed

Preserve SSI Comments #6920

SoftCreatR opened this issue Sep 13, 2021 · 8 comments

Comments

@SoftCreatR
Copy link

It would be nice if we could keep SSI comments (see https://nginx.org/en/docs/http/ngx_http_ssi_module.html) during the build. I know, that there's "removeComments": false in the .htmlnanorc available, but this preserves every comment.

@mischnic
Copy link
Member

This would have to be fixed in htmlnano, see posthtml/htmlnano#73

@SoftCreatR
Copy link
Author

Done. Now, it needs to be integrated into parcel :)

@mischnic
Copy link
Member

This should already work with a .htmlnanorc.js once htmlnano is published. (Though needing a JS config file for this isn't ideal)

@SoftCreatR
Copy link
Author

A new version of htmlnano has been released (1.1.1), but parcel still uses 1.0.1, doesn't it?

@mischnic
Copy link
Member

1.1.1 is covered by the range ^1.0.1: https://jubianchi.github.io/semver-check/#/^1.0.1/1.1.1
So you just need to bump your lockfile.

@SoftCreatR
Copy link
Author

SoftCreatR commented Sep 22, 2021

My yarn.lock is up to date, but my htmlnanorc.js is ignored by parcel (2.0.0-rc.0). Only the .htmlnanorc is being used, and there, I can't make it work. Even the examples (https://htmlnano.netlify.app/modules#removecomments) aren't working.

@mischnic
Copy link
Member

It works correctly for me with

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<!--# include file="footer.html" -->
	</body>
</html>
{
  "dependencies": {
    "parcel": "2.0.0-nightly.843"
  }
}

and .htmlnanorc.js:

module.exports = {
	removeComments: (comments) => {
		return !comments.startsWith("<!--#");
	},
};
`

@SoftCreatR
Copy link
Author

Well... It works 😄 I guess, I just named the file wrong or something... Thank you very much :)

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

No branches or pull requests

2 participants