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

conditional expression support #44

Closed
michalliu opened this issue Jun 30, 2014 · 3 comments
Closed

conditional expression support #44

michalliu opened this issue Jun 30, 2014 · 3 comments

Comments

@michalliu
Copy link

I want a feature which supports conditional include some tpl, what should i do?

@alanshaw
Copy link
Owner

There's a few things you could do:

  1. Submit a pull request
  2. Use something different (perhaps https://github.com/assemble/assemble)
  3. Use a variable in the include statement:
@@include('/path/to/include/@@filename')

Replacements are processed before includes so this is possible. In your grunt config you could specify filename as a global variable and set it depending on your condition:

includereplace: {
  dist: {
    options: {
      globals: {
        filename: condition ? "consequence.html" : "alternative.html"
      }
    },
    src: '*.html',
    dest: 'dist/'
  }
}

@michalliu
Copy link
Author

Thank you

@XhmikosR
Copy link
Contributor

I wish this was supported :/

Because there are valid cases one won't need a separate include but just a different code block.

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

3 participants