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, CoffeeScript and Sass:

  1. <template lang="pug">
  2. h1.red Hello {{ name }}!
  3. </template>
  4. <script lang="coffee">
  5. export default data: ->
  6. { name: 'World' }
  7. </script>
  8. <style lang="sass">
  9. .red
  10. color: red
  11. </style>
  12. <style lang="scss">
  13. .red {
  14. color: red
  15. }
  16. </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 coffeescript coffee-loader
  1. npm install --save-dev node-sass sass-loader