javascript 使用gulp和autoprefixer将sasst编译为css
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 使用gulp和autoprefixer将sasst编译为css相关的知识,希望对你有一定的参考价值。
@charset "UTF-8"
$darkblue: #00008B
.sample
color: $darkblue
font-size: large
display: flex
background-image: linear-gradient(left, red, orange, yellow, green, blue, indigo, violet)
user-select: none
.sample {
color: #00008B;
font-size: large;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
background-image: -webkit-linear-gradient(left, red, orange, yellow, green, blue, indigo, violet);
background-image: linear-gradient(left, red, orange, yellow, green, blue, indigo, violet);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none; }
{
"name": "sass-autoprefixer-sample",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build-css": "rm -rf public && gulp build-css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-plumber": "^1.1.0",
"gulp-sass": "^3.1.0"
}
}
const gulp = require("gulp");
const sass = require("gulp-sass");
const autoprefixer = require("gulp-autoprefixer");
const plumber = require("gulp-plumber");
const path = require("path");
gulp.task("build-css", function() {
gulp.src(path.join(__dirname, "src", "css", "*.sass"))
.pipe(plumber())
.pipe(sass())
.pipe(autoprefixer({browsers: [">= 0.1%"]}))
.pipe(gulp.dest(path.join(__dirname, "public", "css")));
});
以上是关于javascript 使用gulp和autoprefixer将sasst编译为css的主要内容,如果未能解决你的问题,请参考以下文章
javascript 使用Babel,Browserify和Gulp的新ES6项目
gulp 是不是对 javascript 文件进行代码拆分?
gulp-uglify 压缩javascript文件
javascript 使用代理服务器设置gulp示例
javascript Gulp文件优化js,css和图像
Gulp4的基本使用