4 ms·
Can't you just do `Look, this is a backtick: ${'`'}`? Or are you not counting that as "easy" because it's horrible.
by mistercow 9y ago
Can't you just do `Look, this is a backtick: ${'`'}`? Or are you not counting that as "easy" because it's horrible.
- xamuel 9y agoSuppose I wanted to embed your solution itself into a template literal. It would look like this: `${'`'}Look, this is a backtick: \${'${'`'}'}${'`'}`
- Arnavion 9y agoRust has a nice solution to this. r"foo" == "foo" // r" means the literal ends at " r#""foo""# == "\"foo\"" // r#" means the literal ends at "# r##"r#""foo""#"## == "r#\"\"foo\"\"#" // r##" means the literal ends at "## and so on. Basically you add as many # outside as necessary to distinguish the end of the literal (double-quote followed by some #) from any such sequence in the middle of the literal.
- analogic 9y agojust blue my mind. is there a babel plugin that will let me do this?
- sterlingfs 9y agoWeb components are the answer for creating composable templates.