Vue-loader: do not support .sass files very well

Created on 14 Jun 2015  路  8Comments  路  Source: vuejs/vue-loader

<style lang="scss">
  body {
    margin: 0
  }
</style>

and

<style lang="sass">
  body
    margin: 0
</style>

do not work, but

<style lang="sass">
  body {
    margin: 0
  }
</style>

does.

And directly using sass-loader is well. both .scss and .sass files:

require('!style!css!sass?indentedSyntax!./foo.sass')
require('!style!css!sass!./foo.scss')

Most helpful comment

wel... more than one year later and I ran into this again. The docs really needs to updated.

All 8 comments

I tried to add some code in loader(part, lang)

  function loader(part, lang) {
    if (lang === 'sass') {lang = 'sass?indentedSyntax'}
    if (lang === 'scss') {lang = 'sass'}
    lang = lang || defaultLang[part];
    var loader = loaders[lang] !== undefined ? loaders[lang] : loaderPrefix[part] + lang;
    return loader ? loader + '!' : '';
  }

but

<style lang="sass">
  body
    margin: 0
</style>

still not work

This works:

<style lang="sass?indentedSyntax">
  body
    margin: 0
</style>

Or alternatively in the webpack config file:

        test: /\.vue$/, loader: vue.withLoaders({
          sass: "style!css!sass?indentedSyntax"
        })

Thx

Can the docs be updated on the main site if it only works with the added indentedSyntax lang?

+1
Need to be add to the documentation.

wel... more than one year later and I ran into this again. The docs really needs to updated.

You should add

vue: {
  loaders: {
    sass: "vue-style-loader!css-loader!sass?indentedSyntax"
  }
}

into your webpack.config.js's module.exports section to make indentation sass syntax work (note that scss will not).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

C0deZLee picture C0deZLee  路  3Comments

fuyan-run picture fuyan-run  路  3Comments

NextSeason picture NextSeason  路  3Comments

Makio64 picture Makio64  路  4Comments

githoniel picture githoniel  路  3Comments