Are there any best practises I should know about when using CSS in dynamic-forms? I have had success adding a <style> tag to the top of the GSML. But I am worried it could cause problem if I have several snippets on a screen and each snippet has its own style block. Also, I find myself copy/pasting the same style code into multiple snippets. I would prefer to link to a single stylesheet with something like <link rel="stylesheet" type="text/css" href="mystyle.css">
But I don't know how I could control the contents of such a stylesheet
Best Answer
C
Customer Support
said
over 6 years ago
Hi James,
I wouldn't call it a best practice but what I have done in the past is have one single snippet that contains the css and include that snippet in the screens. Do you think that would suit your needs?
I wouldn't call it a best practice but what I have done in the past is have one single snippet that contains the css and include that snippet in the screens. Do you think that would suit your needs?
Kind regards,
- Steve
J
James C. Smith
said
over 6 years ago
This is a useful idea. It is better than copy/pasting the same text into each snippet.
Is there any way to conditionally include a snippet only if it hasn't been included before? Can a snippet somehow set a flag when it is included and have that flag be checked with a {{#if}} in the spots that conditionally include it? My concern is I want my snippets to be self contained. I want to be able to view an individual snippet like "player_details" on its own when designing and debugging it. So I want the "player_detail" snippet to include the css snippet so player_details can run on its own. Similarly "players_virtual_goodls" will also need to same CSS and should be able to run on its own. But then when "player_master" includes both "player_detail" and "player_virtual_goolds" I don't want those snippets to include duplicate copies of the CSS.
I guess "player_master" could pass a param something like "player_detail?embedded=true" and I could check that flag before including the css snippet. But ideally the css snippet itself would set the flag. Or ideally there would just be a simple way to include a snippet only once. Or some other approach to proving style sheets that doesn't make them a snippet.
Customer Support
said
over 6 years ago
Hi James,
Unfortunately I don't know of a way to conditionally include a snippet based on whether it has been included already or not. In terms of your requirements I think your method of including a snippet with a passed parameter might be the best approach for the moment.
James C. Smith
Are there any best practises I should know about when using CSS in dynamic-forms? I have had success adding a <style> tag to the top of the GSML. But I am worried it could cause problem if I have several snippets on a screen and each snippet has its own style block. Also, I find myself copy/pasting the same style code into multiple snippets. I would prefer to link to a single stylesheet with something like <link rel="stylesheet" type="text/css" href="mystyle.css">
Hi James,
I wouldn't call it a best practice but what I have done in the past is have one single snippet that contains the css and include that snippet in the screens. Do you think that would suit your needs?
Kind regards,
- Steve
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi James,
I wouldn't call it a best practice but what I have done in the past is have one single snippet that contains the css and include that snippet in the screens. Do you think that would suit your needs?
Kind regards,
- Steve
James C. Smith
This is a useful idea. It is better than copy/pasting the same text into each snippet.
Is there any way to conditionally include a snippet only if it hasn't been included before? Can a snippet somehow set a flag when it is included and have that flag be checked with a {{#if}} in the spots that conditionally include it? My concern is I want my snippets to be self contained. I want to be able to view an individual snippet like "player_details" on its own when designing and debugging it. So I want the "player_detail" snippet to include the css snippet so player_details can run on its own. Similarly "players_virtual_goodls" will also need to same CSS and should be able to run on its own. But then when "player_master" includes both "player_detail" and "player_virtual_goolds" I don't want those snippets to include duplicate copies of the CSS.
I guess "player_master" could pass a param something like "player_detail?embedded=true" and I could check that flag before including the css snippet. But ideally the css snippet itself would set the flag. Or ideally there would just be a simple way to include a snippet only once. Or some other approach to proving style sheets that doesn't make them a snippet.
Customer Support
Hi James,
Unfortunately I don't know of a way to conditionally include a snippet based on whether it has been included already or not. In terms of your requirements I think your method of including a snippet with a passed parameter might be the best approach for the moment.
Kind regards,
- Steve
James C. Smith
Thanks for your help Steve. Safe to close.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics