Applets use sass

The applets root directory is initialized

npm init

Install gulp, gulp-sass, gulp-rename (gulp-less)

npm i gulp gulp-sass gulp-rename -D

Create glupfile.js in the applet root directory

const gulp = require('gulp'); const rename = require('gulp-rename'); // rename plugin const sass = require('gulp-sass'); Function handleSass() {return gulp.src('miniprogram/**/*.scss' .pipe(sass().on('error', sass.logerror)) // Use gulp-sass to rename({extName: Pipe (gulp.dest('miniprogram')) // export to miniProgram folder} // ignoreInitial: Function watch() {gulp.watch('miniprogram/**/*.scss', {ignoreInitial: false }, handleSass) } exports.default = watchCopy the code

Run the glup command

Run the command in the root directory of the applet using NPX glup if global GLup is not installed, or gulp if global GLup is installed

After the command is executed, you can create a small program in the corresponding moduleindex.scssFile, automatically compiled after savingindex.wxss