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

Is not difined in IF statement #185

Open
self-destructed opened this issue Apr 3, 2021 · 2 comments
Open

Is not difined in IF statement #185

self-destructed opened this issue Apr 3, 2021 · 2 comments

Comments

@self-destructed
Copy link

self-destructed commented Apr 3, 2021

I have some code like this

 @@include("./partials/components/swiper/_swiper.html", {pathtoJSON:
        "./partials/pets/pets.json", el: "pet", class:"watch", controls:"yes"})

in swiper html i have:

@@controls (this works)
@@if(controls === "yes") { 'random text'} (this doest work) 
@@if(@@controls === "yes") { 'random text'} (this also doesnt work)

but i have more if statements in my file and they works.

  @@if (el === "pet"){
    @@loop('./partials/components/swiper/_item-pet.html',
  "@@pathtoJSON")}

  @@if (el === "testimonial"){
    @@loop('./partials/components/swiper/_item-testimon.html',
  "@@pathtoJSON")}

But when i try to add different variables into IF it doesnt work. I can use only one variable for all IF statements in current file?

Error in plugin "gulp-file-include"
Message:
controls is not defined: (controls === "yes")
Details:
domainEmitter: [object Object]
domainThrown: false

@gzmihai
Copy link

gzmihai commented Apr 17, 2021

what worked for me was to use this.controls in @@if condition

@self-destructed
Copy link
Author

what worked for me was to use this.controls in @@if condition
For now, i am wrapping in quotes variables that i use in @@if and they works fine(at least as i wanted).

@@include("./partials/components/swiper/_swiper.html", {pathtoJSON: "./partials/testimonials/testimonials.json", "el": "testimonial", class: "testimonials-swiper", "controls": true})

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

No branches or pull requests

2 participants