http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

Scss compilation

Open Arturokin12 opened this issue 5 years ago • 4 comments

I've been working with scss tag but, using the code in the example, i can't get it to work, i just see a "ReferenceError: sass is not defined" message, how can i make this work?

Arturokin12 avatar May 23 '19 22:05 Arturokin12

I have the same question, where can I get the sass.js ?

ZhaolYang avatar Nov 06 '20 03:11 ZhaolYang

Likewise! It doesn't seem to be the dart-sass compilation.

joshgrift avatar Jan 22 '21 21:01 joshgrift

I have the same question

longqizhu avatar Jan 26 '21 08:01 longqizhu

As mentioned in https://github.com/FranckFreiburger/http-vue-loader/issues/33, you can get sass.js from https://github.com/medialize/sass.js

To avoid receiving "ReferenceError: sass is not defined", declare a variable sass and assign an instance constructed by sass.js.

The following example works for me.

<script src="<path_to>/sass.js"></script>
<script>
  const sass = new Sass()
  httpVueLoader.langProcessor.scss = function (scssText) {
    return new Promise(function(resolve, reject) {
      sass.compile(scssText, function (result) {
        if ( result.status === 0 )
          resolve(result.text)
        else
          reject(result)
      });
    });
  }
  new Vue({
    el: '#my-app',
    components: {
      'my-component': httpVueLoader('my-component.vue')
    }
  });
</script>

uier avatar Feb 12 '21 07:02 uier