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

Add support for file names with multiple periods on them. #237

Merged
merged 2 commits into from
May 7, 2015

Conversation

starstuffharvestingstarlight

When compiling html files with names containing periods, the compile function creates invalid ts output.

Options used:

options: {
  htmlModuleTemplate: 'Templates',
  htmlVarTemplate: '<%= filename %>_<%= ext %>'
}

Example:
test.view.example.index.html -> test.view.example.index.html.ts

Outputs test.view.example.index.html.ts:

module mctUntitledAppTemplates_Dev { export var test_view.example.index_html =  '<html><body>Hello world' }

Which then causes a compile error:

test.view.example.index.html.ts(1,58): error TS1005: ',' expected.
test.view.example.index.html.ts(1,66): error TS1005: ',' expected.

This commit includes a basic fix by replacing all occurrences of '\.'. Note that it might be a good idea to replace other special js characters.

I have too many files with this naming scheme, so a fix would be great. Thank you!

@nycdotnet
Copy link
Contributor

Thanks for the PR. This looks good. Any chance you can write a test?

@starstuffharvestingstarlight
Copy link
Author

Done! Note that compilation will actually fail if you revert 639f5ad so it never gets to the actual test. I added a couple of output checks anyway. Thanks for your quick feedback!

nycdotnet added a commit that referenced this pull request May 7, 2015
Add support for file names with multiple periods on them.
@nycdotnet nycdotnet merged commit 42233c1 into TypeStrong:master May 7, 2015
@nycdotnet
Copy link
Contributor

Well done. Thanks very much.

nycdotnet added a commit that referenced this pull request May 7, 2015
nycdotnet added a commit that referenced this pull request May 7, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants