1

While trying to learn javascript, I stumbled upon Typescript and decided to rather learn that. I installed Atom and the atom-typescript module and coded a typescript class, which compiles to a .js file. I created an index.html page with the .js in a script tag.

As far as I understand, in order to test the js code, I have to start a webserver and load index.html.

What would be a convenient way to do that? At least, I would like to manually run the script from Atom with a keyboard shortcut. Ideally, I would like the browser to refresh every time the typescript file changes in Atom. No google result I could find explains how to do that, is that a difficult thing to do?

1 Answer 1

1

What would be a convenient way to do that?

Use browserify to reload your webapp everytime the JS changes. Also use nodemon to restart your webserver each time the backend JS changes.

Example:

Checkout http://typescriptbuilder.com/

Nodemon config: https://github.com/TypeScriptBuilder/tsb/blob/master/nodemon.json

Wepack config: https://github.com/TypeScriptBuilder/tsb/blob/master/src/webpack.config.ts

Webpack config during devtime: https://github.com/TypeScriptBuilder/tsb/blob/8a7d48d71a8327d48822fa15eb52b9adb1953223/src/server/devtime.ts#L15-L82

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I upvoted your answer, however, none of the solutions you posted seem to be an easy solution for Atom? Typescriptbuilder looks interesting, but I'd rather not have another editor installed and configured. I guess there is no click-on-a-button solution in Atom available, which is also an answer.
Typescriptbuilder looks interesting, but I'd rather not have another editor installed and configured a.) Its not ready. I was showing how to model such a project, I'm developing it in atom-ts. b.) Its just npm install tsb -g (once released) + zero config :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.