Skip to content

Commit 04bf8c6

Browse files
committed
Support css-loader inheritance and local imports
1 parent f81850f commit 04bf8c6

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased][unreleased]
6-
### Changed
7-
- Nothing yet.
6+
### Added
7+
- Support for css-loader [inheritance](https://github.com/webpack/css-loader#inheriting) and [local imports](https://github.com/webpack/css-loader#importing-local-class-names).
88

99
## [0.0.4] - 2015-05-22
1010
### Changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function transformSelector(options, rule, selector) {
2828
return selector
2929
.replace(/\:global\((.*?)\)/g, escapeDots)
3030
.replace(/\:global (.*)/g, escapeDots)
31+
.replace(/(\:extends\((.*?)\))/g, escapeDots)
3132
.replace(/\.local\[(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)\]/g, '.$1') // source: http://stackoverflow.com/questions/448981/what-characters-are-valid-in-css-class-names-selectors
3233
.replace(/\:local\(\.(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)\)/g, '.$1')
3334
.replace(/\.(-?[_a-zA-Z]+[_a-zA-Z0-9-]*)/g, ':local(.$1)')

test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ var tests = [
114114
input: 'input {}',
115115
expected: 'input {}'
116116
},
117+
{
118+
should: 'support :extends',
119+
input: '.foo:extends(.className) {}',
120+
expected: ':local(.foo):extends(.className) {}'
121+
},
122+
{
123+
should: 'support imported :extends',
124+
input: '.foo:extends(.button from "library/button.css") {}',
125+
expected: ':local(.foo):extends(.button from "library/button.css") {}'
126+
}
117127
];
118128

119129
function process (css, options) {

0 commit comments

Comments
 (0)