Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m unsure

Is it possible to conditionally load @include files?

Can @include js files be added conditionally (just wrapped in an if/then) or are they always loaded?
2 people have
this question
+1
Reply
  • Unfotunately we don't support this at the moment as all includes are being executed at the beginning of the loading process.

    What you can do, in the meanwhile, is add the conditional inside the include, for example: different code for each platform.
    • Once we see real-life situation for this need we can understand better if, how and where conditional includes are needed and see if we need to push it up at our features pipeline.
      So far we saw the need for different includes for different platform and this (as mentioned) can be solved by adding all platforms code into the include and doing something like this:
      if (appAPI.platform == "IE") {
      //your IE code
      } else if (appAPI.platform == "FF") {
      //your FF code
      } else if (appAPI.platform == "CH") {
      //your Chrome code
      } else {
      //your code for any platform which is not supported yet by Crossrider
      }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited