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

How do I prevent parcel changing script variable names (without --no-minify)? #3934

Closed
nevernotsean opened this issue Dec 20, 2019 · 3 comments

Comments

@nevernotsean
Copy link

nevernotsean commented Dec 20, 2019

❔ Question

How do I prevent parcel changing script variable names without --no-minify?

πŸ”¦ Context

I'm creating a Doubleclick banner with parcel. Doubleclick banners require a global variable called clickTag. Parcel is changing the name of this variable. Using --no-minify works, but my js/css files are then unminified.

πŸ’» Code Sample

.htmlnanorc
{ "collapseAttributeWhitespace": false, "collapseBooleanAttributes": false, "collapseWhitespace": "conservative", "custom": [], "deduplicateAttributeValues": false, "mergeScripts": false, "mergeStyles": false, "removeUnusedCss": false, "minifyJs": false, "minifySvg": false, "removeEmptyAttributes": false, "removeRedundantAttributes": false, "removeComments": false }

index.html:
`
<script>
var clickTag = "http://www.google.com";
</script>

`

after build
`
<script>
var o = "http://www.google.com";
</script>

`

🌍 Your Environment

Software Version(s)
Parcel 1.12.4
Node 12.13.0
npm/Yarn npm 6.12.0
Operating System MacOSX Mojave
@mischnic
Copy link
Member

window.clickTag would work

@nevernotsean
Copy link
Author

Great answer, Although the HTML5 Validator (https://h5validator.appspot.com/) still gives my ZIP a CLICK_TAG_MISSING. I'm going to close this because I think the real issue is with the validator -- it is only looking for var clickTag, even though the banner ad works fine.

@welljs
Copy link

welljs commented Apr 24, 2024

2024 and the same issue. Has there been a solution for this year?

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

4 participants