Skip to content

Commit

Permalink
fix: separate sass and scss - BREAKING CHANGE (#69)
Browse files Browse the repository at this point in the history
BREAKING CHANGE
  • Loading branch information
aaharu authored and manniL committed Aug 7, 2019
1 parent becf6cb commit 6b69f4d
Show file tree
Hide file tree
Showing 8 changed files with 3,131 additions and 2,662 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -36,7 +36,8 @@ export default {

styleResources: {
// your settings here
sass: [], // alternative: scss
sass: [],
scss: [],
less: [],
stylus: []
}
Expand Down
5 changes: 3 additions & 2 deletions lib/module.js
Expand Up @@ -52,7 +52,7 @@ export default function nuxtStyledResources() {
}

if (sass.length) {
scss.push(...sass)
this.extendBuild(extendSass(sass))
}

if (scss.length) {
Expand Down Expand Up @@ -89,7 +89,8 @@ const extendWithSassResourcesLoader = matchRegex => resources => (config) => {
})
}

const extendScss = extendWithSassResourcesLoader(/s[ac]ss/)
const extendSass = extendWithSassResourcesLoader(/sass/)
const extendScss = extendWithSassResourcesLoader(/scss/)
const extendLess = extendWithSassResourcesLoader(/less/)

module.exports.meta = require('../package.json')
2 changes: 2 additions & 0 deletions test/fixture/sass/assets/a.sass
@@ -0,0 +1,2 @@
h1
background-color: $white
1 change: 1 addition & 0 deletions test/fixture/sass/assets/nested/index.sass
@@ -0,0 +1 @@
$white: #fff
5 changes: 5 additions & 0 deletions test/fixture/sass/components/Sass.vue
Expand Up @@ -10,3 +10,8 @@
line-height: pow(4, 2);
}
</style>

<style lang="sass">
.ymca
background-color: $white
</style>
5 changes: 3 additions & 2 deletions test/fixture/sass/nuxt.config.js
Expand Up @@ -3,12 +3,13 @@ const { resolve } = require('path')
module.exports = {
rootDir: resolve(__dirname, '../../../'),
srcDir: resolve(__dirname),
css: ['@/assets/a.scss'],
css: ['@/assets/a.scss', '@/assets/a.sass'],
render: {
resourceHints: false
},
styleResources: {
scss: ['@/assets/nested/index.scss', 'mathsass']
scss: ['@/assets/nested/index.scss', 'mathsass'],
sass: ['@/assets/nested/index.sass']
},
modules: ['@@'],
build: {
Expand Down
1 change: 1 addition & 0 deletions test/module.test.js
Expand Up @@ -35,6 +35,7 @@ describe('nuxt-style-resources', () => {
const window = await (nuxt.server || nuxt).renderAndGetWindow(url('/'))
const headHtml = window.document.head.innerHTML
expect(headHtml).toContain('.ymca{color:#333;line-height:16')
expect(headHtml).toContain('.ymca{background-color:#fff')
})

afterEach(async () => {
Expand Down
5,771 changes: 3,114 additions & 2,657 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 6b69f4d

Please sign in to comment.