-
-
Notifications
You must be signed in to change notification settings - Fork 399
Jss Components #68
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
Comments
|
Yes, i got confused, because https://github.com/jsstyles/jss#create-style-sheet-with-namespaces-enabled includes an example, where it prints: console.log(sheet.classes.myButton) // .jss-0 |
why is it confusing, its a class generated by jss |
I did not see: var sheet = jss.createStyleSheet({
'.something': {
width: '100px',
height: '100px'
}
}, {named: false}).attach() which prevents the changes |
I don't undestand confusion, its an example for global selectors .... |
My problem is, that Both approaches need me to adapt my I understand, I could write the whole module in javascript, using for example With |
You lost me somewhere in the middle, now give me code. |
Given:
(see: example/export-css.js) // [index.js]
var styles = require('./bundle.css');
var template = require('./index.template.html');
var css2jss = require('jss/lib/cssToJss');
var __ = document.createElement('div');
module.exports = function projectName (parameter) {
var arguments = {};
arguments.title = parameter.title || "Hello World";
arguments.message = parameter.message || "Welcome to components";
var component = (__.innerHTML=template;__.querySelector('.projectName'));
var __title = component.querySelector('.projectName__title');
var __message = component.querySelector('.projectName__message');
var sheet = css2jss(styles.inner);
__title.innerHTML = arguments.title;
__message.innerHTML = arguments.message;
sheet.attach();
document.body.appendChild(component);
} |
I'm not completely sure if I use In order to get Those don't know about the prefixes that were added and I wonder how to approach that. |
|
css2jss has been also created to translate pure css to jss without generated selectors ... |
now I am not sure whats the use case to use jss and css-modulesify together |
actually there is a good way to use them together. |
So basically
|
Consider this still as a temporary approach to move fast to jss. Because this way you still can't reuse css code the way js allows it to do. Its still a very limited approach. |
Ok, thx, at least my understanding improved a bit for now. I'll continue to follow this awesome project :-) thx |
I might have a component with a css file, a javascript file and an html template.
With the help of css2jss (in branch 15) i might be able to start using jss which then prefixes my classes and gives me access to the prefix during runtime.
How would I use that to not break my
templates
and javascript baseddocument.querySelector(...)
and the like? They have to be aware of the prefix, right?The text was updated successfully, but these errors were encountered: