gulp关于scss的基础配置

项目中用到的scss的配置,记录一下,谁叫咱脑袋不行呢

var gulp = require('gulp');var plugins = require('gulp-load-plugins')();var del = require('del');var paths = {    styles:['app/scss/ /*.scss'],    outSytles:'app/css/',    outSourcemaps:'app/css_sourcemaps',    images: ['images/ ','oa/images/ ']};var reloadOptions= {    port:8010,    host:'localhost',    basePath:'./app/',    start:true,    reloadPage:'oa/contacts.html'};gulp.task('scss',function(){    return gulp.src(paths.styles)        .pipe(plugins.changed(paths.outSytles))        .pipe(plugins.sourcemaps.init())        .pipe(plugins.sass({            outputStyle: 'compressed'        }))        .on("error", plugins.notify.onError(function (error) {            return "哎哟喂: " + error.message;        }))        .pipe(plugins.sourcemaps.write({includeContent: false}))        .pipe(plugins.autoprefixer({            browsers: ['>1%'],            cascade: false,            remove:false        }))        .pipe(plugins.sourcemaps.write())        // .pipe(plugins.rename({suffix: '.min'}))        .pipe(gulp.dest(paths.outSytles))        .pipe(plugins.notify({            title:'scss编译',            message:'编译完成,没报错就成功...',            onLast:true        }))        .pipe(plugins.livereload());});gulp.task('watch', function() {    gulp.watch(['app/ ']).on('change', plugins.livereload.changed);    gulp.watch(paths.styles, ['scss']);    plugins.livereload.listen(reloadOptions);});// 清除css文件夹gulp.task("css_clear", function() {    del([paths.outSytles + '/ ','!weui.min.css'])})gulp.task('default',['watch','scss']);

关键字:gulp, 工作流

版权声明

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部