Compiling coffeescript of webstorm writing in JS

Source: Internet
Author: User
Tags json
A friend who has written python or Ruby should like to Coffeescript, if not too familiar with Coffeescript's friends can go to the official website to make up a lesson coffeescript.org
Believe that after using the coffeescript you will not want to go back to write JavaScript, webstorm support Coffeescript very good, as it is for Nodejs support as well, using its file The Watchers feature plus Coffee.cmd makes it easy to compile JavaScript files instantly when you write Coffeescript, which is to say that the settings in Webstorm are File Watchers experiencing problems. According to the official website prompts, the need installs first nodejs , then installs Coffeescript
NPM install-g Coffee-script
After installation, you can compile with the coffee command at the command line, but this always complains when you set the compile command to coffee in Webstorm
Compile an error prompt:
However, you can use coffee to compile a file on the command line without any problems.
Content of Helloword.coffee:
Console.log "Hello word!"
Compile:
C:userszhong>coffee-c Helloword.coffee
The contents of the compiled Helloword.js file:
Generated by Coffeescript 1.8.0
(function () {
  console.log ("Hello word!");

}). Call (this);
So, the coffee.cmd most common way to get one is to create a new file under the project package.json and write it in the package.json file:
{
    "name": "Application-name", "
    Version": "0.0.1",
    "dependencies": {
        "coffee-script": "*"
    }
}
After execution npm install node_modules , you get a directory that node_modules .bin has a file in the coffee.cmd directory directory
And then we'll set the path of this file to the value in the File Watchers Program
This allows you to compile the Coffeescript script that is being written in Webstorm.
In fact, I prefer Grunt to use to replace it, with grunt not only easy to set up, but also management, porting to other PCs more convenient, more important it to make up for the Webstorm and webstorm support it very well. In Webstorm you can't concat multiple files after compile, and in grunt it's all very easy to set up. In fact, webstorm editing function is very good, combined with grunt such a great building tool, can be said to develop very handy. In Webstorm you can even automatically identify if you have a Gruntfile.js file and then give you an option, you only need to click to execute a command:
In fact, Coffeescript in debugging is still a pain, the current chrome to Coffeescript debugging has done very friendly, and then there are a few fatal problems urgently need to be resolved
The first point is the breakpoint problem, if you do the Web side, you need to break the place is to refresh before running, so you set breakpoints to refresh after the breakpoint is gone, the most current practice is in the breakpoint place to get a Func, finished in the console directly call Func.
The second is the monitoring variables, such as the expression you want to monitor, however, you are in the monitoring of the fn augr syntax is wrong, which is a bit depressing, the breakpoint file Coffeescript, get the monitor variable does not support Coffeescript syntax.
Finally, the compilation of the problem, Coffeescript compiled JavaScript are tab=2 indentation, which in compile did not find the option to set the tab size.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.