Skip to content

Theming is not possible #203

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
hypercube-software opened this issue Dec 11, 2015 · 3 comments
Closed

Theming is not possible #203

hypercube-software opened this issue Dec 11, 2015 · 3 comments

Comments

@hypercube-software
Copy link

CSS modules are great, but I after webpack build, all generated names are hidden in the bundle. It should be great to generate a single mapping file that contain:

<file>|<style name>=<mangled name>

for instance

/src/widgets/MyComponent.css|title = _2IezJF1AI1wN8JrvVVyB9-

Without this, I can't do that:
An external CSS (not a CSS Module, a regular one, a THEME written by my client) that contain
keywords like @MyComponent.title@ that could be transformed in _2IezJF1AI1wN8JrvVVyB9-
before putting it in prod.

With that, My client could do theming with rules like:

.@MyComponent.title@ {
  background-color: #30FF36 !important;
}

Actually, I'm stuck. And no, theming with inline styles is not a solution. I want to use :hover or whatever I want.

What do you think about this idea ?
Note: my requirement is that the application can change it's theme at runtime and the theme is not
defined at development time. it is not predefined themes.

Regards.
Eric.

@developit
Copy link

Can't you just use deterministic local names? The configuration would just be:

{
    test: /.css/,
    loader: 'css-loader?localIdentName=[path][name]'
}

Example:

/* style.css */
.foo {
    background-color: #30FF36;
}
import { foo } from './style.css';
console.log( foo );
// "style_foo"

@hypercube-software
Copy link
Author

Indeed, it would be the easiest thing to do. A hash would be more compact... anyway, I will go with your idea.

@developit
Copy link

Glad I could help! 👍

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

No branches or pull requests

3 participants