Skip to content

Commit eeaf205

Browse files
authored
add less relative import (#349)
1 parent 68ea450 commit eeaf205

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

e2e/__projects__/style/components/Less.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<div>
33
<div :class="$style.a">a</div>
44
<div :class="styles.b">b</div>
5+
<div :class="$style.c">c</div>
6+
<div :class="styles.d">d</div>
57
</div>
68
</template>
79

@@ -19,6 +21,7 @@ export default defineComponent({
1921
</script>
2022

2123
<style module lang="less">
24+
@import './styles/less-a.less';
2225
.a {
2326
background-color: @primary-color;
2427
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import "variables";
2+
.c {
3+
color: @primary-color;
4+
}
5+
.d {
6+
background-color: @primary-color;
7+
}

e2e/__projects__/style/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function mount(Component, props, slots) {
2525
test('processes Less', () => {
2626
mount(Less)
2727
expect(document.getElementById('app').innerHTML).toEqual(
28-
'<div><div class="a">a</div><div class="b">b</div></div>'
28+
'<div><div class="a">a</div><div class="b">b</div><div class="c">c</div><div class="d">d</div></div>'
2929
)
3030
})
3131

lib/process-style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function getPreprocessOptions(lang, filePath, jestConfig) {
4242
})
4343
}
4444
}
45-
if (lang === 'styl' || lang === 'stylus') {
45+
if (lang === 'styl' || lang === 'stylus' || lang === 'less') {
4646
return {
4747
paths: [path.dirname(filePath), process.cwd()]
4848
}

0 commit comments

Comments
 (0)