Nodejs compiling SASS Module Package Node-compass, and Gulp package Gulp-sass use method

Source: Internet
Author: User

Summary: Node Express or node project, to automatically compile sass methods, such as gulp, such as koalas, such as today I want to say this package node-compass.
    • Method One: Command-line compilation sass:
    • Method Two: Gulp-sass
    • Method Three: Node-compass
Method One: Command-line compilation sass:
1 Compass Compile

Enter confirmation to generate the corresponding CSS code

Method Two: Gulp-sass

1. Prerequisites:

The computer has Ruby installed,

The project has been installed with the configuration of the basic gulp (configuration and installation is not covered in this article.) Gulp basic usage also not introduced)

2. Download the Gulp-sass package:

NPM Install Gulp-sass--save-dev

3. Basic usage:

Add the following code to your gulpfile.js:

1 varGulp = require (' Gulp '));2 varSass = require (' Gulp-sass '));3 4Gulp.task ("Sass",function() {5     returnGULP.SRC ("Test/*.scss")6. Pipe (Sass (). On ("Error", Sass.logerror))7. Pipe (Gulp.dest ("Public/css"));8 });9 TenGulp.task (' Watch ',function () { OneGulp.watch ("Public/sass/*.scss", ["Sass"]); A});

Explanation: The first two sentences into the module, there is nothing to say it.

The 5th sentence: gulp.src () The parameters for your sass file, such as "Test/a.scss"--the automatic compilation of the test folder under the A.scss. If you need to compile all the Scss files under the folder, use * to indicate: Test/*.scss.

6th sentence: Write

If you have used gulp or koalas to automatically compile sass, then you must know: When you finish writing a sass, the basic is that the corresponding CSS code will be generated at the same time. But Node-compass not, you have to be on the web.

Nodejs compiling SASS Module Package Node-compass, and Gulp package Gulp-sass use method

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.