Comments (5)
For prefixing an approach similar to https://github.com/requireio/wrap-selectors might be interesting, though you say it won't work well when writing out to a file.css. Can you elaborate?
As for the cascading: I think the top level > lower level seems like a good approach. Some level of cascade would be nice though; reset.css
-ish styles could be provided by low level components on which higher level components can in turn build. Currently that doesn't work since the component expects a class to exist on the element before css can render.
from base-element.
wrap-selectors
looks interesting but I didn't like how you need to use custom syntax @document wrap() { }
. I'd prefer if I could just write regular CSS relative to the element and the API would figure out what to do, especially with nested elements. That way existing CSS/compile-to-CSS can be brfs
or attached to elements more easily.
you say it won't work well when writing out to a file.css. Can you elaborate?
If the class name is dynamically generated, it will be different upon each initialization. So if previously compiled to a file.css
, the selectors localizing to the element will no longer be correct. Besides enforcing a user supplied root class on each element, I'm not sure yet of a better way to solve that.
Some level of cascade would be nice though;
I agree. It would be nice if the element author had some control over how it will cascade. It would also help optimize to avoid selectors like: .my-table .super-table .base-table
for deeply nested situations.
My main goal is an elegant alternative to inline styles. Elements provide an overridable static style for a separately served asset or if the user really wants to avoid the request, an inline nonce
'd style tag. Then do element.style[key] = val
for all dynamic styles. That way I can disable inline style outright in my CSP.
from base-element.
It appears webpack
is also scoping css: https://github.com/markdalgleish/postcss-local-scope. Not sure I like their non-standard :global
syntax though. Also doesn't deal with cascading styles. Ghmmh, gonna ponder a little on this.
from base-element.
I agree. Let me know if you come up with more options for us to try. I moved the attachCSS
stuff into it's own module: https://github.com/shama/attach-css
from base-element.
Opened an issue about this on attach-css
- shama/attach-css#1
from base-element.
Related Issues (11)
- server side rendering
- Add function removeEventListener HOT 2
- Combine the server / client test script
- combine node.render() + this.afterRender() ? HOT 7
- Document setTimeout delay rationale HOT 3
- replaceChild vs appendChild HOT 5
- Security HOT 2
- .toString()? HOT 2
- Rename `.on()`? HOT 7
- Default __appendTo__ to false instead of document.body HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from base-element.