RunJS supports CoffeeScript/Less CSS Online Editing

Source: Internet
Author: User
Tags css preprocessor

Have you noticed that you can use CoffeeScript in RunJS to write scripts and Less CSS to write styles.

Let's take a look at the Demo code:

CoffeeScript:

# Assignment:

Number = 42

Opposite = true

# Conditions:

Number =-42 if opposite

# Functions:

Square = (x)-> x * x

# Arrays:

List = [1, 2, 3, 4, 5]

# Objects:

Math =

Root: Math. sqrt

Square: square

Cube: (x)-> x * square x

# Splats:

Race = (winner, runners...)->

Print winner, runners

# Existence:

Alert "I knew it !" If elvis?

# Array comprehensions:

Cubes = (math. cube num for num in list)

Document. write "Result:" + cubes

LESS:

@ Bgcolor: # CCC;

Body {

Background-color: @ bgcolor;

}

However, by default, RunJS uses JavaScript and CSS. How can I enable CoffeeScript and Less CSS?

Enable CoffeeScript

Move the cursor to the JavaScript panel and click JavaScript, as shown in:

The script selection dialog box is displayed. Select CoffeeScript and click OK:

In the same way, you can click CSS on the CSS editing panel to choose to write styles with Less CSS:

Note:

CoffeeScript, a programming language built on JavaScript, is compiled into efficient JavaScript, so that you can run it on a web browser, or through a Node such as for server applications. js technologies. The compilation process is usually very simple. The generated JavaScript is consistent with many best practices. Details

Less CSS is a widely used CSS Preprocessor that extends CSS with simple syntax and variables to reduce the amount of CSS code. Details

Now let's try to use RunJS that supports CoffeeScript and Less CSS.

Http://runjs.cn

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.