Vue-cli: Dart Sass support as a stylesheet preprocessor option

Created on 7 Jul 2018  路  9Comments  路  Source: vuejs/vue-cli

What problem does this feature solve?

node-sass is the most painful node dependency in the entirety of the npm ecosystem. Plus dart sass is faster, allows code sharing with docker (no binaries), never breaks installations after a system or node update...

I realize there will be limitations... which I'm willing to work around for the benefits

What does the proposed API look like?

$ vue-cli generate foo

Sass ( node-sass )
Sass ( Dart Sass - Experimental ) *
Less
Stylus
contribution welcome enhancement intend to implement

Most helpful comment

I tried to use dart-sass according sass-loader's example and it works well.

/* vue.config.js */
module.exports = {
  css: {
    loaderOptions: {
      sass: {
        implementation: require('sass')
      }
    }
  }
}
"devDependencies": {
  "@vue/cli-plugin-babel": "^3.0.4",
  "@vue/cli-plugin-typescript": "^3.0.4",
  "@vue/cli-service": "^3.0.4",
  "sass": "^1.14.1",
  "sass-loader": "^7.0.1",
  "typescript": "^3.0.0",
  "vue-template-compiler": "^2.5.17"
}

All 9 comments

We don't have a hard dependency on node-sass - sass-loadee needs it. Does sass-loadee support dart-sass as well, or does a fork exist or something?

At the end of the day we need a loader for it.

As I can see, in https://github.com/webpack-contrib/sass-loader/issues/435, it's not currently supported inside sass-loader.

The merge request https://github.com/webpack-contrib/sass-loader/pull/573 let sass-loader be "implementation-agnostic" but it's not currently merged.

I think it's a good idea to have dart-sass because it's the official package referenced in Sass lang as a npm provider:

But I think you'll wait sass-loader support dart-sass if you want webpack support.

Well I'm not sure how using dart sass would work without a loader supporting it, since the whole build process of vue-cli is built around webpack.

@LinusBorg https://github.com/webpack-contrib/sass-loader/pull/573 is the loader

it could be implemented as a generator time option... like fountainjs has been doing it... Sass (dart-sass experimental)

Well, that PR hasn't been merged yet, so as of today there's no loader that supports dart -sass, right?

The prophecy is upon us:

Rather than always loading Node Sass, this now requires users to pass in
either Dart Sass or Node Sass as an option to the loader.

commit: bed9fb5799a90020d43f705ea405f85b368621d7

https://github.com/webpack-contrib/sass-loader/commit/bed9fb5799a90020d43f705ea405f85b368621d7

IMO dart-sass should be the default sass compiler because now it's the official sass compiler.

It's also my opinion but like I see after the merge request of the sass loader, node-sass still the default implementation proposed. It could be a choice during creation from vue cli I think.

I tried to use dart-sass according sass-loader's example and it works well.

/* vue.config.js */
module.exports = {
  css: {
    loaderOptions: {
      sass: {
        implementation: require('sass')
      }
    }
  }
}
"devDependencies": {
  "@vue/cli-plugin-babel": "^3.0.4",
  "@vue/cli-plugin-typescript": "^3.0.4",
  "@vue/cli-service": "^3.0.4",
  "sass": "^1.14.1",
  "sass-loader": "^7.0.1",
  "typescript": "^3.0.0",
  "vue-template-compiler": "^2.5.17"
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gonzalo2683 picture Gonzalo2683  路  3Comments

BusyHe picture BusyHe  路  3Comments

Akryum picture Akryum  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

b-zee picture b-zee  路  3Comments