Skip to content

Add support for postcss-nested plugin #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"postcss-modules-local-by-default": "^1.1.1",
"postcss-modules-parser": "^1.1.0",
"postcss-modules-scope": "^1.0.2",
"postcss-modules-values": "^1.2.2"
"postcss-modules-values": "^1.2.2",
"postcss-nested": "^1.0.1"
},
"description": "Transforms styleName to className using compile time CSS module resolution.",
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src/requireCssModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import postcss from 'postcss';
import genericNames from 'generic-names';
import ExtractImports from 'postcss-modules-extract-imports';
import LocalByDefault from 'postcss-modules-local-by-default';
import Nested from 'postcss-nested';
import Parser from 'postcss-modules-parser';
import Scope from 'postcss-modules-scope';
import Values from 'postcss-modules-values';
Expand Down Expand Up @@ -66,6 +67,7 @@ export default (cssSourceFilePath: string, options: OptionsType): StyleModuleMap
};

const plugins = [
Nested,
Values,
LocalByDefault,
ExtractImports,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './bar.scss';

<div styleName="a_modified"></div>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.a {
background-color: #ffffff;
&_modified {
background-color: #000000;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import './bar.scss';

<div className="bar__a_modified"></div>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"plugins": [
[
"../../../../src",
{
"generateScopedName": "[name]__[local]",
"filetypes": {
".scss": "postcss-scss"
}
}
]
]
}