首页 > 其他分享 >Less 安装和hello world

Less 安装和hello world

时间:2023-03-02 20:58:54浏览次数:64  
标签:style 1.0 Less -- +-- less world 2.0 hello

本文提供了LESS安装的步骤过程。

 

LESS的系统要求

  • 操作系统:跨平台

  • 浏览器支持: IE(Internet Explorer 8+),Firefox,Google Chrome,Safari。

 

安装LESS

步骤(1):我们需要NodeJ运行LESS示例。 要下载NodeJ,请打开链接 https://nodejs.org/en/ ,您 会看到如下所示的屏幕:

 

下载NodeJ

 

下载zip文件的最新功能版本。

步骤(2):接下来,运行安装程序以在系统上安装 Node.js 。

步骤(3):接下来,通过NPM(节点程序包管理器)在服务器上安装LESS。 在命令提示符下运行以下命令。

npm install -g less

步骤(4):接下来,在成功安装LESS后,您将在命令提示符下看到以下行:

`-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | |   +-- [email protected]
  | |   `-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   `-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | +-- [email protected]
  | | +-- [email protected]
  | | | +-- [email protected]
  | | | | `-- [email protected]
  | | | +-- [email protected]
  | | | +-- [email protected]
  | | | | `-- [email protected]
  | | | +-- [email protected]
  | | | `-- [email protected]
  | | +-- [email protected]
  | | | `-- [email protected]
  | | +-- [email protected]
  | | | +-- [email protected]
  | | | +-- [email protected]
  | | | | `-- [email protected]
  | | | +-- [email protected]
  | | | `-- [email protected]
  | | `-- [email protected]
  | |   `-- [email protected]
  | +-- [email protected]
  | | +-- [email protected]
  | | +-- [email protected]
  | | +-- [email protected]
  | | `-- [email protected]
  | +-- [email protected]
  | | +-- [email protected]
  | | +-- [email protected]
  | | | +-- [email protected]
  | | | +-- [email protected]
  | | | `-- [email protected]
  | | `-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   | `-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   +-- [email protected]
  | |   `-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | `-- [email protected]
  `-- [email protected]

 

例子

下面是一个简单的LESS示例。

hello.htm

<!doctype html>
<head>
	<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
	<h1>Welcome to W3Cschool</h1>
	<h3>Hello!!!!!</h3>
</body>
</html>

接下来,让我们创建一个与CSS非常相似的文件 style.less ,唯一的区别是它将以 .less 扩展名保存。 应在文件夹 nodejs 中创建文件 .html 和 .less 。

 

 

style.less

@primarycolor: #FF7F50;
@color:#800080;
h1{
color: @primarycolor;
}
h3{
color: @color;
}

 

使用以下命令将 style.less 文件编译为 style.css :

lessc style.less style.css
  创建 style.css

 

当您运行上述命令时,它将自动创建 style.css 文件。 无论何时更改LESS文件,都需要在cmd中运行上面的命令,然后更新 style.css 文件。

 

运行以上命令时, style.css 文件将具有以下代码:

 

style.css

h1 {
  color: #FF7F50;
}
h3 {
  color: #800080;
}

 

输出

让我们执行以下步骤,看看上面的代码如何工作:

  • 将上面的html代码保存在 hello.htm 文件中。

  • 在浏览器中打开此HTML文件,将显示如下输出。

 

输出

Less编译css工具

     您可以使用Less编译成css工具进行测试

   

 

from:https://www.w3cschool.cn/less/less_installation.html

 

标签:style,1.0,Less,--,+--,less,world,2.0,hello
From: https://www.cnblogs.com/im18620660608/p/17173402.html

相关文章

  • less编译的几种方法
    1.考拉软件编译http://koala-app.com/index-zh.html要引入编译后的css文件考拉会在后台监听2.js在线编译<linkrel="stylesheet/less"type="text/css"href="css/l......
  • LESS 快速使用入门指南简介
    LessCSS是一个使用广泛的CSS预处理器,通过简单的语法和变量对CSS进行扩展,可减少很多CSS的代码量。LESS将CSS赋予了动态语言的特性,如变量、继承、运算、函数......
  • Serverless 时代开启,云计算进入业务创新主战场
    作者:于洪涛“我们希望让用户做得更少而收获更多,通过Serverless化,让企业使用云服务像用电一样简单。”Serverless化正在成为全新的软件研发范式,阿里云将坚定推进核心......
  • Serverless 时代开启,云计算进入业务创新主战场
    作者:于洪涛“我们希望让用户做得更少而收获更多,通过Serverless化,让企业使用云服务像用电一样简单。”Serverless化正在成为全新的软件研发范式,阿里云将坚定推进核心产品......
  • Windows10下使用Intel SGX功能(二):helloworld流程分析
    目录参考文献helloworld代码解读代码目录结构调用流程1.首先定义host和enclave之间相互调用的函数2.实现enclave端的enclave_helloworld()逻辑3.实现host端......
  • Java开始指路之Hello world
    1.新建文件夹code,然后创建Hello.txt,重命名为Hello.java,进行编写代码2.cmd对应目录3.javacHello.java,(编译Hello.java文件,生成Hello.class文件)4.javaHello(运行Hel......
  • error in ./src/components/NumberInfo/NumberInfo.vue?vue&type=style&index=0&id=
      删除NumberInfo中的scoped,因为使用了antdv的css变量,加了scoped导致获取不到......
  • 《HelloGitHub》第 83 期
    兴趣是最好的老师,HelloGitHub让你对编程感兴趣!简介HelloGitHub分享GitHub上有趣、入门级的开源项目。https://github.com/521xueweihan/HelloGitHub这里有实......
  • HelloTypeScript
    HelloTypeScriptTypeScript是JS的超级,是一个可选的、静态的类型系统静态的(类型检查发生的时间,在编译的时候,而非运行时)类型系统(对代码中所有的标识符(变量、函数、参数......
  • python-flask之helloworld
    python环境安装:python3.10python工具安装:pycharm社区版安装flask可以用pipinstallflask安装;也可以直接在pycharm中输入fromflaskimportFlask后点击安装。编......