autoprefixer in *.vue files, custom compiler setup
var compiler = require('vue-loader');
var stylus = require('stylus');
var autoprefixer = require('autoprefixer-core');
module.exports = function(compiler) {
// register a compile function for <style lang="stylus-prefixed">
compiler.register({
lang: 'stylus-prefixed',
type: 'style',
compile: function(content, cb) {
stylus.render(content, {}, function(err, css) {
var prefixed = autoprefixer.process(css).css;
// transform the content...
cb(err, prefixed);
});
}
});
};
// example-component.vue
<style lang="stylus-prefixed">
.pane
display flex
</style>
<template>
<div class="pane">{{msg}}</div>
</template>
<script>
module.exports = {
data: function () {
return {
msg: 'Hello world!'
}
}
}
</script>
Enjoy!