-
Notifications
You must be signed in to change notification settings - Fork 260
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
Conditionally include tags based on features #907
Comments
Interesting idea. Could you come up with a PR for that? |
I'll dig into it |
After looking at the conventions closer, instead of introducing a There are some concerns though, if a user decide to use the Lines 14 to 26 in 4c9d85f
Instead of coupling the conditional inclusion with rust features, maybe we should use env vars instead? In my use case for example, the google analytics tag has nothing to do with my rust code and there is actually no corresponding feature. Moreover, current following the env var idea, it can be for example So this can be a potential design too:
|
Is there a way to conditionally include some <script> tags based on features?
I want to only include some google analytics script tag on production build, as opposed to staging or dev environments
I propose a
data-trunk-feature
attributeSay this is in the index.html:
<script data-trunk-feature="analytics" async src=“https://www.googletagmanager.com/gtag/js?id=G-....” ></script>
This will only gets included with
trunk build --features analytics
The text was updated successfully, but these errors were encountered: