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

Support concatenating to single output file #2

Closed
dlee opened this issue Apr 15, 2014 · 2 comments
Closed

Support concatenating to single output file #2

dlee opened this issue Apr 15, 2014 · 2 comments

Comments

@dlee
Copy link

dlee commented Apr 15, 2014

When I use /// <reference path="..." /> to refer to typescript source files, I want those files to be concatenated in the output .js file.

@gavinhungry
Copy link
Owner

@dlee,

This module isn't meant to read any files, it's just meant to take a string of TypeScript and output a string of JavaScript.

But, would this suffice?

/**
 * Compile a string of TypeScript, return as a string of JavaScript
 *
 * @param {String} input - TypeScript to compile
 * @param {Object} [refs] - map of referenced filenames to content
 * @return {String} JavaScript output
 * @throws TypeScript compile error
 */

ts.compile('/// <reference path="foo.ts" />', {
  'foo.ts': 'var bar = 123;'
});

This would make the user responsible for loading the files into memory as strings, then passing all of the content to compile.

This is implemented now on the master branch. Let me know if it works for you.

@dlee
Copy link
Author

dlee commented Apr 16, 2014

Thanks! I think that would work.

@dlee dlee closed this as completed Apr 16, 2014
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