RUNJS support coffeescript/less CSS Online editing

Source: Internet
Author: User
Tags css preprocessor

Have you noticed that you can now write the script using Coffeescript directly on the RUNJS, using less CSS to write the style.

Let's look at a 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;

}

But runjs by default or by using JavaScript and CSS, how do I enable coffeescript and less CSS?

Enable Coffeescript

Move the mouse over the JavaScript panel and click JavaScript as shown in the following image:

After clicking, it will pop up the script selection dialog box, select Coffeescript and then determine:

The same way into the CSS editing panel click CSS to choose to write styles with less CSS:

Note notes:

Coffeescript, a programming language built on JavaScript, is compiled into efficient javascript so that you can run it on a Web browser or use it through a node.js class of technologies such as server-side applications. The compilation process is usually simple, and the resulting javascript is consistent with many of the best practices. Detailed Introduction

Less CSS is a wide range of CSS preprocessor, with simple syntax and variables to extend the CSS, can reduce the amount of code in the CSS. Detailed Introduction

Now go and experience the RUNJS that supports coffeescript and less CSS.

http://runjs.cn

Related Article

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.