Home Web Front-end JS Tutorial A brief discussion on the different methods of introducing less, sass and css styles into Vue-cli single file components

A brief discussion on the different methods of introducing less, sass and css styles into Vue-cli single file components

May 30, 2018 pm 04:18 PM
less sass vue-cli

Below I will share with you a brief discussion on the different methods of introducing less, sass, and css styles into Vue-cli single-file components. It has a good reference value and I hope it will be helpful to everyone.

vue-cli has built-in sass and lass configurations. If necessary, just download two modules directly, and webpack will automatically use the appropriate loader to process them based on the lang attribute.

If you need to use sass, install:

npm install node-sass --save-dev 
npm install sass-loader --save-dev
Copy after login

If you need to use less, install:

npm install less --save-dev 
npm install less-loader --save-dev
Copy after login

sass’s inline writing:

<style lang="sass" scoped> 
 //sass样式 
</style>
Copy after login

less’s inline writing:

<style lang="less" scoped> 
 //less样式 
</style>
Copy after login

css’s inline writing:

<style lang="css" scoped> 
 //css样式 
</style>
Copy after login

Sass reference writing:

<style lang="sass" src="./index.sass"></style>
Copy after login

less reference writing:

<style lang="less" src="./index.less"></style>
Copy after login

css reference writing:

<style lang="css"> 
   @import &#39;./index.css&#39; 
</style> 
 或者 
<style lang="css" src="./index.css"></style>
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Angular uses the filter uppercase/lowercase to implement letter case conversion function example

Angular uses the operation event command ng -Click to pass multiple parameters example

JavaScript code to implement the upload preview function of txt files

The above is the detailed content of A brief discussion on the different methods of introducing less, sass and css styles into Vue-cli single file components. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does sass software mean? What does sass software mean? Aug 15, 2022 am 11:39 AM

The full name of SASS is "Software as a service", which means "software as a service"; it is a software deployment model in which third-party suppliers build applications on cloud infrastructure and provide these to customers through the Internet in the form of subscriptions. applications that do not require customers to build the underlying infrastructure upfront. This means that the software can be accessed on any device with an internet connection and a web browser, unlike traditional software that can only be installed on your local machine.

What does sass mean when vue creates a project? What does sass mean when vue creates a project? Jun 21, 2022 am 10:33 AM

The sass used by Vue when creating a project is to strengthen the css auxiliary tool and is an extension of css; sass is a css preprocessing language written in the buby language. It has the same strict indentation style as html and is consistent with css writing specifications. Curly braces and semicolons are not used.

Vue-cli3.0 scaffolding to create Vue project steps and process Vue-cli3.0 scaffolding to create Vue project steps and process Jun 09, 2023 pm 04:08 PM

Vue-cli3.0 is a new scaffolding tool based on Vue.js. It can help us quickly create a Vue project and provides many convenient tools and configurations. Below we will introduce step by step the steps and process of creating a project using Vue-cli3.0. To install Vue-cli3.0, you first need to install Vue-cli3.0 globally. You can install it through npm: npminstall-g@vue/cli

The use of Vue-cli scaffolding and its plug-in recommendations The use of Vue-cli scaffolding and its plug-in recommendations Jun 09, 2023 pm 04:11 PM

Vue-cli is a scaffolding tool officially provided by Vue.js to build Vue projects. By using Vue-cli, you can quickly build the basic skeleton of a Vue project, allowing developers to focus on the implementation of business logic without spending a lot of time. To configure the basic environment of the project. This article will introduce the basic usage of Vue-cli and commonly used plug-in recommendations, aiming to provide a guide to the use of Vue-cli for beginners. 1. Basic usage of Vue-cli Install Vue-cli

A detailed guide to using Vue-cli in Vue A detailed guide to using Vue-cli in Vue Jun 26, 2023 am 08:03 AM

Vue is a popular front-end framework favored by many developers for its flexibility and ease of use. In order to better develop Vue applications, the Vue team has developed a powerful tool-Vue-cli, which makes it easier to develop Vue applications. This article will introduce you to the use of Vue-cli in detail. 1. Install Vue-cli Before using Vue-cli, you need to install it first. First, you need to make sure you have Node.js installed. Then, install Vue-c using npm

Vue-cli scaffolding tool usage and project configuration instructions Vue-cli scaffolding tool usage and project configuration instructions Jun 09, 2023 pm 04:05 PM

Instructions for using Vue-cli scaffolding tools and project configuration. With the continuous development of front-end technology, front-end frameworks are attracting more and more attention from developers. As a leader in front-end frameworks, Vue.js has been widely used in the development of various web applications. Vue-cli is a command line-based scaffolding officially provided by Vue.js. It can help developers quickly initialize the Vue.js project structure, allowing us to focus more on business development. This article will introduce the installation and installation of Vue-cli

What to do if there is an error when compiling SASS in vue project What to do if there is an error when compiling SASS in vue project Jan 05, 2023 pm 04:20 PM

Solution to the Vue project compilation sass error: 1. Use the image source "cnpm install node-sass sass-loader --save-dev" to install sass; 2. Change the "sass-loader" version in "package.json" to " "sass-loader": "^7.3.1","; 3. Use it directly in the page or use @ instead of src.

How to deploy nginx to access projects built by vue-cli How to deploy nginx to access projects built by vue-cli May 15, 2023 pm 10:25 PM

The specific method is as follows: 1. Create the backend server object upstreammixVueServer{serverbaidu.com;#This is your own server domain name} 2. Create the access port and reverse proxy rule server{listen8082;server_namelocalhost;location/{rootE:/mix_vue/dist;# Locate the directory of the project#indexindex.htmlindex.htm;try_files$uri$uri//index.html;#Configure according to the rules of the official website}location~\.php${proxy_p

See all articles