How to compile sass using Gulp

Source: Internet
Author: User
Tags install node
How to compile sass Gulp is an automated tool that frontend developers can use to process common tasks:

1. Set up a web Server

2. automatically reload the browser when saving the file

3. Use preprocessors such as Sass and LESS

4. Optimize resources, such as compressing CSS, JavaScript, and images

Of course, Gulp can do more than that. If you are crazy enough, you can even use it to build a Static Page Generator. Gulp is really powerful enough, but you must learn to control it.

This is the main purpose of this Article. It helps you understand the basic usage of Gulp and help you complete the great success of the whole world as soon as possible.

What we will do

At the end of this article, you will have a simple workflow:

Compile Sass

In addition, you will also learn to use simple command chain to call multiple tasks.

Install Gulp

Install Node. js before installing Gulp.

If you have not installed Node, you can download it here.

After installing Node. js, Use Terminal (cmd in win) and the following command to install Gulp

$ Sudo npm install gulp-g

Only mac users need The sudo command and do not copy the $ symbol. This is not your dish.

Npm install is a command that specifies the installation from Node Package Manager (npm you are afraid of Mao.

-G indicates global installation, so that you can only use the gulp command anywhere on your computer.

Mac users require administrator privileges to install the service globally, so sudo is required.

Next, use Gulp to create a project.

Create a Gulp Project

First, create a project folder and run the npm init command in the directory:

$ Npm init

The npm init command will create a package. json file for you, which stores information about this project. For example, the various dependencies you use (mainly plug-ins here) (The following content is automatically displayed in the plugin, which can be left blank first)

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.