Skip to content

Commit c5740e3

Browse files
committed
Merge pull request #44 from css-modules/2.0.0
2.0.0
2 parents 7851fd2 + efcc88a commit c5740e3

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Compiling in runtime, [universal](https://medium.com/@mjackson/universal-javascr
1616

1717
To use this tool we require [Node.js v0.12.x](https://github.com/nodejs/node) (or higher) and several modules to be installed.
1818

19-
- [postcss](https://github.com/postcss/postcss) version 4 or higher
19+
- [postcss](https://github.com/postcss/postcss) version 5 or higher
20+
- [postcss-modules-values](https://github.com/css-modules/postcss-modules-values)
2021
- [postcss-modules-extract-imports](https://github.com/css-modules/postcss-modules-extract-imports)
2122
- [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default)
2223
- [postcss-modules-scope](https://github.com/css-modules/postcss-modules-scope)

package.json

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "css-modules-require-hook",
3-
"version": "1.0.11",
3+
"version": "2.0.0-beta",
44
"description": "A require hook to compile CSS Modules on the fly",
55
"main": "index.js",
66
"engines": {
77
"node": ">=0.12"
88
},
99
"dependencies": {
1010
"debug": "^2.2.0",
11+
"icss-replace-symbols": "^1.0.2",
1112
"lodash.assign": "^3.2.0",
1213
"lodash.identity": "^3.0.0",
1314
"lodash.isarray": "^3.0.4",
@@ -18,7 +19,7 @@
1819
"devDependencies": {
1920
"babel": "^5.8.20",
2021
"babel-eslint": "^4.0.5",
21-
"css-modules-loader-core": "0.0.12",
22+
"css-modules-loader-core": "^1.0.0",
2223
"eslint": "^1.0.0",
2324
"eslint-config-airbnb": "0.0.7",
2425
"eslint-config-airbnb-lite": "^1.0.3",
@@ -27,17 +28,19 @@
2728
"isparta": "^3.0.3",
2829
"lodash": "^3.10.1",
2930
"mocha": "^2.2.5",
30-
"postcss": "5.x",
31-
"postcss-modules-extract-imports": "^1.0.0-beta",
32-
"postcss-modules-local-by-default": "^1.0.0-beta",
33-
"postcss-modules-scope": "^1.0.0-beta",
31+
"postcss": "^5.x",
32+
"postcss-modules-extract-imports": "^1.0.0",
33+
"postcss-modules-local-by-default": "^1.0.0",
34+
"postcss-modules-scope": "^1.0.0",
35+
"postcss-modules-values": "^1.1.0",
3436
"precommit-hook": "^3.0.0"
3537
},
3638
"peerDependencies": {
37-
"postcss": ">=4.x",
38-
"postcss-modules-extract-imports": ">=0.x || ^1.0.0-beta",
39-
"postcss-modules-local-by-default": ">=0.x || ^1.0.0-beta",
40-
"postcss-modules-scope": ">=0.x || ^1.0.0-beta"
39+
"postcss": "^5.x",
40+
"postcss-modules-extract-imports": "^1.0.0",
41+
"postcss-modules-local-by-default": "^1.0.0",
42+
"postcss-modules-scope": "^1.0.0",
43+
"postcss-modules-values": "^1.1.0"
4144
},
4245
"scripts": {
4346
"start": "esw -w .",

src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import identity from 'lodash.identity';
88
import pick from 'lodash.pick';
99
import postcss from 'postcss';
1010

11+
import Values from 'postcss-modules-values';
1112
import ExtractImports from 'postcss-modules-extract-imports';
1213
import LocalByDefault from 'postcss-modules-local-by-default';
1314
import Scope from 'postcss-modules-scope';
@@ -71,6 +72,7 @@ export default function setup(opts = {}) {
7172

7273
plugins = [
7374
...prepend,
75+
Values,
7476
mode
7577
? new LocalByDefault({mode: opts.mode})
7678
: LocalByDefault,

src/parser.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { plugin } from 'postcss';
2+
import replaceSymbols from 'icss-replace-symbols';
23

34
const importRegexp = /^:import\((.+)\)$/;
45

@@ -30,11 +31,7 @@ export default plugin('parser', function parser(opts = {}) {
3031
});
3132
};
3233

33-
const linkImportedSymbols = css => css.eachDecl(decl => {
34-
Object.keys(translations).forEach(translation => {
35-
decl.value = decl.value.replace(translation, translations[translation]);
36-
});
37-
});
34+
const linkImportedSymbols = css => replaceSymbols(css, translations);
3835

3936
const handleExport = exportNode => {
4037
exportNode.each(decl => {

0 commit comments

Comments
 (0)