From 20f946ec75824293c826bc10a24d92a4e6b7a9c2 Mon Sep 17 00:00:00 2001 From: Alexey Litvinov Date: Thu, 22 Oct 2015 11:58:10 +0300 Subject: [PATCH 1/4] version update for the postcss 5.x --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8392e2d..6d384a2 100644 --- a/package.json +++ b/package.json @@ -27,17 +27,17 @@ "isparta": "^3.0.3", "lodash": "^3.10.1", "mocha": "^2.2.5", - "postcss": "5.x", - "postcss-modules-extract-imports": "^1.0.0-beta", - "postcss-modules-local-by-default": "^1.0.0-beta", - "postcss-modules-scope": "^1.0.0-beta", + "postcss": "^5.x", + "postcss-modules-extract-imports": "^1.0.0", + "postcss-modules-local-by-default": "^1.0.0", + "postcss-modules-scope": "^1.0.0", "precommit-hook": "^3.0.0" }, "peerDependencies": { - "postcss": ">=4.x", - "postcss-modules-extract-imports": ">=0.x || ^1.0.0-beta", - "postcss-modules-local-by-default": ">=0.x || ^1.0.0-beta", - "postcss-modules-scope": ">=0.x || ^1.0.0-beta" + "postcss": "^5.x", + "postcss-modules-extract-imports": "^1.0.0", + "postcss-modules-local-by-default": "^1.0.0", + "postcss-modules-scope": "^1.0.0" }, "scripts": { "start": "esw -w .", From 2048f51c0d2e4d71a69e77cf472d9a0bd2a242ad Mon Sep 17 00:00:00 2001 From: Alexey Litvinov Date: Thu, 22 Oct 2015 12:10:08 +0300 Subject: [PATCH 2/4] values and symbols added --- package.json | 7 +++++-- src/index.js | 2 ++ src/parser.js | 7 ++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 6d384a2..3c37047 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "dependencies": { "debug": "^2.2.0", + "icss-replace-symbols": "^1.0.2", "lodash.assign": "^3.2.0", "lodash.identity": "^3.0.0", "lodash.isarray": "^3.0.4", @@ -18,7 +19,7 @@ "devDependencies": { "babel": "^5.8.20", "babel-eslint": "^4.0.5", - "css-modules-loader-core": "0.0.12", + "css-modules-loader-core": "^1.0.0", "eslint": "^1.0.0", "eslint-config-airbnb": "0.0.7", "eslint-config-airbnb-lite": "^1.0.3", @@ -31,13 +32,15 @@ "postcss-modules-extract-imports": "^1.0.0", "postcss-modules-local-by-default": "^1.0.0", "postcss-modules-scope": "^1.0.0", + "postcss-modules-values": "^1.1.0", "precommit-hook": "^3.0.0" }, "peerDependencies": { "postcss": "^5.x", "postcss-modules-extract-imports": "^1.0.0", "postcss-modules-local-by-default": "^1.0.0", - "postcss-modules-scope": "^1.0.0" + "postcss-modules-scope": "^1.0.0", + "postcss-modules-values": "^1.1.0" }, "scripts": { "start": "esw -w .", diff --git a/src/index.js b/src/index.js index 55dee04..a34dc5a 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ import identity from 'lodash.identity'; import pick from 'lodash.pick'; import postcss from 'postcss'; +import Values from 'postcss-modules-values'; import ExtractImports from 'postcss-modules-extract-imports'; import LocalByDefault from 'postcss-modules-local-by-default'; import Scope from 'postcss-modules-scope'; @@ -71,6 +72,7 @@ export default function setup(opts = {}) { plugins = [ ...prepend, + Values, mode ? new LocalByDefault({mode: opts.mode}) : LocalByDefault, diff --git a/src/parser.js b/src/parser.js index 84c6cdf..15c47e9 100644 --- a/src/parser.js +++ b/src/parser.js @@ -1,4 +1,5 @@ import { plugin } from 'postcss'; +import replaceSymbols from 'icss-replace-symbols'; const importRegexp = /^:import\((.+)\)$/; @@ -30,11 +31,7 @@ export default plugin('parser', function parser(opts = {}) { }); }; - const linkImportedSymbols = css => css.eachDecl(decl => { - Object.keys(translations).forEach(translation => { - decl.value = decl.value.replace(translation, translations[translation]); - }); - }); + const linkImportedSymbols = css => replaceSymbols(css, translations); const handleExport = exportNode => { exportNode.each(decl => { From e97a4d5ec4a0769f2ddfee28aaac38faab64eba1 Mon Sep 17 00:00:00 2001 From: Alexey Litvinov Date: Thu, 22 Oct 2015 12:10:22 +0300 Subject: [PATCH 3/4] readme update --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fe7ed4..48bde76 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Compiling in runtime, [universal](https://medium.com/@mjackson/universal-javascr To use this tool we require [Node.js v0.12.x](https://github.com/nodejs/node) (or higher) and several modules to be installed. -- [postcss](https://github.com/postcss/postcss) version 4 or higher +- [postcss](https://github.com/postcss/postcss) version 5 or higher +- [postcss-modules-values](https://github.com/css-modules/postcss-modules-values) - [postcss-modules-extract-imports](https://github.com/css-modules/postcss-modules-extract-imports) - [postcss-modules-local-by-default](https://github.com/css-modules/postcss-modules-local-by-default) - [postcss-modules-scope](https://github.com/css-modules/postcss-modules-scope) From efcc88a9ee8e6206def7c45c962a7f7a0fdb8b59 Mon Sep 17 00:00:00 2001 From: Alexey Litvinov Date: Thu, 22 Oct 2015 12:14:10 +0300 Subject: [PATCH 4/4] version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3c37047..e2535f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "css-modules-require-hook", - "version": "1.0.11", + "version": "2.0.0-beta", "description": "A require hook to compile CSS Modules on the fly", "main": "index.js", "engines": {