How to use pre-processors?

Thanks to Vue Loader, you can use any kind of pre-processors for your <template>, <script> or <style>: simply use the lang attribute.

Example of our pages/index.vue using Pug, CoffeeScript and Sass:

<template lang="pug"> Hello {{ name }}!

<script lang="coffee">
module.exports = data: ->
  { name: 'World' }

<style lang="sass">
  color: red

<style lang="scss">
.red {
  color: red

To be able to use these pre-processors, we need to install their webpack loaders:

npm install --save-dev pug@2.0.0-beta6 pug-loader coffee-script coffee-loader node-sass sass-loader

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!