How to use CSS pre-processors?

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

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

  1. <template lang="pug">
  2. h1.red Hello World!
  3. </template>
  4. <style lang="sass">
  5. .red
  6. color: red
  7. </style>
  8. <style lang="scss">
  9. .red {
  10. color: red;
  11. }
  12. </style>

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

  1. npm install --save-dev pug pug-plain-loader
  1. npm install --save-dev node-sass sass-loader