Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vue-loader
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pi-plusplus
fork-from-github
vue-loader
Commits
082c6eaf
Commit
082c6eaf
authored
Dec 14, 2018
by
wmzy
Committed by
Evan You
Dec 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: css modules extends error (#1452)
fix #1449
parent
614b764c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
styleInjection.js
lib/codegen/styleInjection.js
+1
-0
css-modules-extend.vue
test/fixtures/css-modules-extend.vue
+17
-0
style.spec.js
test/style.spec.js
+40
-0
No files found.
lib/codegen/styleInjection.js
View file @
082c6eaf
...
...
@@ -48,6 +48,7 @@ module.exports = function genStyleInjectionCode (
styleInjectionCode
+=
`
cssModules[
${
name
}
] =
${
locals
}
Object.defineProperty(this,
${
name
}
, {
configurable: true,
get: function () {
return cssModules[
${
name
}
]
}
...
...
test/fixtures/css-modules-extend.vue
0 → 100644
View file @
082c6eaf
<
style
module
>
.red
{
color
:
#FF0000
;
}
</
style
>
<
script
>
import
CssModuleSimple
from
'./css-modules-simple.vue'
export
default
{
extends
:
CssModuleSimple
}
</
script
>
<
template
>
<div
:class=
"$style.red"
></div>
</
template
>
\ No newline at end of file
test/style.spec.js
View file @
082c6eaf
...
...
@@ -182,3 +182,43 @@ test('CSS Modules', async () => {
/css-modules---red---
\w{5}
/
)
})
test
(
'CSS Modules Extend'
,
async
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
baseLoaders
=
[
'vue-style-loader'
,
{
loader
:
'css-loader'
,
options
:
{
modules
:
true
}
}
]
mockBundleAndRun
({
entry
:
'css-modules-extend.vue'
,
modify
:
config
=>
{
config
.
module
.
rules
=
[
{
test
:
/
\.
vue$/
,
loader
:
'vue-loader'
},
{
test
:
/
\.
css$/
,
use
:
baseLoaders
}
]
}
},
({
window
,
module
,
instance
,
jsdomError
,
bundleError
})
=>
{
if
(
jsdomError
)
return
reject
(
jsdomError
)
if
(
bundleError
)
return
reject
(
bundleError
)
const
vnode
=
mockRender
(
module
)
expect
(
vnode
.
data
.
class
).
toBe
(
instance
.
$style
.
red
)
const
style
=
window
.
document
.
querySelectorAll
(
'style'
)[
1
].
textContent
expect
(
style
).
toContain
(
`.
${
instance
.
$style
.
red
}
{\n color: #FF0000;\n}`
)
resolve
()
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment