Skip to content
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

Leading _ in exported classname #541

Closed
Diokuz opened this issue May 24, 2017 · 10 comments
Closed

Leading _ in exported classname #541

Diokuz opened this issue May 24, 2017 · 10 comments

Comments

@Diokuz
Copy link

Diokuz commented May 24, 2017

bug

What is the current behavior?

:export {
  ._x { color: red }
}

transformed to object

exports.locals = {
	"x": "src⁄x___x"
};

If the current behavior is a bug, please provide the steps to reproduce.
just use [css-loader, postcss-loader] with this postcss.config.js:

const plugins = [
  require('postcss-modules-local-by-default'),
  require('postcss-modules-scope')(),
];

exports.plugins = plugins;

What is the expected behavior?
should be

exports.locals = {
	"_x": "src⁄x___x"
};

Please mention other relevant information such as your webpack version, Node.js version and Operating System.

node@7 webpack@2 css-loader@0.28.2

@Diokuz
Copy link
Author

Diokuz commented May 24, 2017

Looks like you cannot take just prop here, because of this

@alexander-akait
Copy link
Member

@Diokuz interesting, _x is valid ident for css-modules, maybe we need question about this here https://github.com/css-modules/postcss-modules-values

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 24, 2017

You use postcss-modules-* plugins in postcss.config.js + postcss-loader ?

@michael-ciniawsky
Copy link
Member

That could be a problem then, since css-loader implements CSSM via these plugins and if the source CSS is already transformed this might not work

@TrySound
Copy link
Contributor

@michael-ciniawsky We can fix that :)

@michael-ciniawsky
Copy link
Member

@TrySound We should fix that 😛 once and for all, always problems 🐛 atm... :D

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 24, 2017

@Diokuz Does it work without the plugins in postcss.config.js ?

@alexander-akait
Copy link
Member

@TrySound Am i right what we should fix this in postcss-modules-values?

@Diokuz
Copy link
Author

Diokuz commented May 24, 2017

You use postcss-modules-* plugins in postcss-config.js + postcss-loader ?

Yes, postcss-loader then css-loader

@Diokuz Does it work without the plugin in postcss.config.js ?

Without plugins it creates not what I need

/***/ "./src/x.css":
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__("./node_modules/css-loader/lib/css-base.js")(undefined);
// imports


// module
exports.push([module.i, "._x {\n  color: red;\n}\n", ""]);

@alexander-akait
Copy link
Member

Done in #543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants