Naive regex matching breaks inlining with comments
See original GitHub issueDue to the way the inlining works with regex, when there is a comment that matches the pattern, the build fails. For example, this won’t build:
/**
@Component({
selector: 'example',
templateUrl: './example.component.html'
})
export class Example {
}
*/
@Component({
selector: 'my-comp',
template: '<div class="my-comp"></div>'
})
export class MyComponent {
}
It will fail with the following error:
Error: ENOENT: no such file or directory, open ‘/Users/user/Documents/project/src/app/comp/example.component.html’
Any chance of moving away from gulp-inline-ng2-template and into something like ts-simple-ast for inlining assets? Working with an AST would avoid this issue altogether.
Perhaps a workaround for now could be to remove comments before inlining.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to match a lookbehind of exactly 1 or 2 line break(s) or ...
I've observed that (?s) matches even if there's no \n before. (?s) is an inline flag which turns on re.DOTALL mode so ....
Read more >re — Regular expression operations — Python 3.11.1 ...
A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a...
Read more >documentation - Commenting regular expressions
(If you want to match a space in a verbose regular expression, you'll need to escape it by putting a backslash in front...
Read more >RegEx in Excel: using regular expressions in formulas - Ablebits
MultiLine - determines whether to match the pattern across line breaks in multi-line strings or only in the first line. In our codes,...
Read more >Single-Line Comments - Regular Expressions Cookbook, 2nd ...
Just make sure the option “dot matches line breaks” is turned off when using this regular expression.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solved by #279
@elclanrs FYI
If it helps, this is how we inline assets currently, using the ts-simple-ast library: https://gist.github.com/elclanrs/c1944bf16cb8448b543872995db3ff82