Skip to content

Commit

Permalink
🐛 Fix sass loader options
Browse files Browse the repository at this point in the history
Dependency upgrades broke the css-loader options in vue.config.js, that provided variables and mixins access for all files. This is solved by using style-resources-loader instead.
  • Loading branch information
greengiraffe committed Nov 3, 2019
1 parent ec89747 commit 3cf333a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"name": "wingspan-helper",
"version": "1.0.0",
"private": true,
"author": {
"name": "Valentin von Guttenberg"
},
"homepage": "https://wingspan-helper.now.sh",
"license": "MIT",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"test:unit": "vue-cli-service test:unit"
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.3.6",
Expand All @@ -37,6 +35,10 @@
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.1.0",
"style-resources-loader": "^1.2.1",
"vue-cli-plugin-style-resources-loader": "^0.1.3",
"vue-template-compiler": "^2.6.10"
}
},
"homepage": "https://wingspan-helper.now.sh",
"license": "MIT"
}
27 changes: 16 additions & 11 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
const path = require('path')

module.exports = {
css: {
loaderOptions: {
sass: {
data: `@import "@/styles/_variables.scss"; @import "@/styles/_mixins.scss";`
}
}
},
pwa: {
name: "Wingspan Helper",
themeColor: "#cae6f3",
msTileColor: "#cae6f3",
assetsVersion: "1.0",
name: 'Wingspan Helper',
themeColor: '#cae6f3',
msTileColor: '#cae6f3',
assetsVersion: '1.0',
iconPaths: {
favicon32: 'img/icons/favicon-32x32.png',
favicon16: 'img/icons/favicon-16x16.png',
appleTouchIcon: 'img/icons/icon-152x152.png',
maskIcon: 'img/icons/maskable-icon.svg',
msTileImage: 'img/icons/icon-144x144.png'
}
},

pluginOptions: {
'style-resources-loader': {
preProcessor: 'scss',
patterns: [
path.resolve(__dirname, 'src/styles/_variables.scss'),
path.resolve(__dirname, 'src/styles/_mixins.scss')
]
}
}
}
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9833,6 +9833,17 @@ strip-json-comments@^3.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7"
integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==

style-resources-loader@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/style-resources-loader/-/style-resources-loader-1.2.1.tgz#7679d5dc2f27046b2fc2b83c1d5b6c1b8a9b820c"
integrity sha512-ekId7AwZRW429UjQo02CJTt0Y8GwoT9zidvJLq4lRTJbu0cghv9XNRmt9mS4MR41+gZwMRT0EpFzP68HDWLbXQ==
dependencies:
glob "^7.1.2"
is-callable "^1.1.4"
is-plain-object "^2.0.4"
is-promise "^2.1.0"
loader-utils "^1.1.0"

stylehacks@^4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5"
Expand Down Expand Up @@ -10476,6 +10487,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019"
integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw==

vue-cli-plugin-style-resources-loader@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/vue-cli-plugin-style-resources-loader/-/vue-cli-plugin-style-resources-loader-0.1.3.tgz#0fed01f429ba4af2f4265161dbeab9e9d233e810"
integrity sha512-yUu71+z45AII83QBjL0H5qNumjdnKoMR+2QicP0GCF7nNqCQ8hN4TK7lcYpC9eZrzljZ+Vt8KPhyhMHkvmyTxw==

vue-eslint-parser@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz#00f4e4da94ec974b821a26ff0ed0f7a78402b8a1"
Expand Down

1 comment on commit 3cf333a

@vercel
Copy link

@vercel vercel bot commented on 3cf333a Nov 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.