Skip to content

Instantly share code, notes, and snippets.

@andrewmmc
Last active January 8, 2018 09:45
Show Gist options
  • Save andrewmmc/1da3bade76bc6b975260440127f61542 to your computer and use it in GitHub Desktop.
Save andrewmmc/1da3bade76bc6b975260440127f61542 to your computer and use it in GitHub Desktop.
[SASS] @import globally available in Webpack Sass-loader

SASS - @import globally available in Webpack Sass-loader

utils.js

// References: https://github.com/vuejs-templates/webpack/issues/149

let sassOptions = {
    indentedSyntax: true
  }
  let scssOptions = {
    includePaths: [
      '~src/styles'
    ],
    data: '@import "~src/styles/main";'
  }

  // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
  return {
    css: generateLoaders(),
    postcss: generateLoaders(),
    less: generateLoaders('less'),
    sass: generateLoaders('sass', sassOptions),
    //  Make custom SASS available to all components https://github.com/webpack-contrib/sass-loader
    scss: generateLoaders('sass', scssOptions),
    stylus: generateLoaders('stylus'),
    styl: generateLoaders('stylus')
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment