首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Visual Studio 2015自动修复程序

Visual Studio 2015自动修复程序
EN

Stack Overflow用户
提问于 2016-01-26 19:29:02
回答 1查看 1.8K关注 0票数 2

我发现Web Essentials autoprefixer不够自动-我需要手动说出来才能添加前缀。此外,当我编写.less.scss时,它不会为我提供前缀。

有没有什么扩展或选项可以让它在.less.scss stage的css编译中自动添加前缀?

我尝试过Web Compiler扩展,但它不支持sass的前缀,并且说它支持更少的前缀,但我在编写.less时尝试在compilerconfig.json中启用自动重定位,但它没有添加任何东西。

有没有适合visual studio的东西?或者也许我应该抛弃它,使用一些编辑器+大口?

EN

回答 1

Stack Overflow用户

发布于 2016-01-26 22:08:34

我确信将会有一个扩展,但是创建一个Grunt/Gulp文件来为您进行编译并不是太多的工作。然后,任务运行器资源管理器将管理文件的运行。编写自己的扩展将为您提供扩展所不能提供的控制和灵活性。

这是一个使用Grunt的示例,取自我在主题Getting started with Grunt, SASS and Task Runner Explorer上的帖子

代码语言:javascript
复制
module.exports = function (grunt) {
    'use strict';

    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        // Sass
        sass: {
            options: {
                sourceMap: true, // Create source map
                outputStyle: 'compressed' // Minify output
            },
            dist: {
                files: [
                  {
                      expand: true, // Recursive
                      cwd: "sass", // The startup directory
                      src: ["**/*.scss"], // Source files
                      dest: "stylesheets", // Destination
                      ext: ".css" // File extension 
                  }
                ]
            }
        },

        // Autoprefixer
        autoprefixer: {
            options: {
                browsers: ['last 2 versions'],
                map: true // Update source map (creates one if it can't find an existing map)
            },

            // Prefix all files
            multiple_files: {
                src: 'stylesheets/**/*.css'
            }, 
        },

        // Watch
        watch: {
            css: {
                files: ['sass/**/*.scss'],
                tasks: ['sass', 'autoprefixer'],
                options: {
                    spawn: false
                }
            }
        }
    });

    grunt.registerTask('dev', ['watch']);
    grunt.registerTask('prod', ['sass', 'autoprefixer']);
};
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35012798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档