我发现Web Essentials autoprefixer不够自动-我需要手动说出来才能添加前缀。此外,当我编写.less或.scss时,它不会为我提供前缀。
有没有什么扩展或选项可以让它在.less或.scss stage的css编译中自动添加前缀?
我尝试过Web Compiler扩展,但它不支持sass的前缀,并且说它支持更少的前缀,但我在编写.less时尝试在compilerconfig.json中启用自动重定位,但它没有添加任何东西。
有没有适合visual studio的东西?或者也许我应该抛弃它,使用一些编辑器+大口?
发布于 2016-01-26 22:08:34
我确信将会有一个扩展,但是创建一个Grunt/Gulp文件来为您进行编译并不是太多的工作。然后,任务运行器资源管理器将管理文件的运行。编写自己的扩展将为您提供扩展所不能提供的控制和灵活性。
这是一个使用Grunt的示例,取自我在主题Getting started with Grunt, SASS and Task Runner Explorer上的帖子
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']);
};https://stackoverflow.com/questions/35012798
复制相似问题